<script type="text/javascript">
function writetag() {
        document.write ('<a href="' + myurlvar + '"><img src="' +
myimgvar + '"></a>');
}
</script>

<script type="text/javascript">writetag()</script>


you could also do:

<script type="text/javascript">
     function writetag(el) {
          var tag = '<a href="' + myurlvar + '"><img src="' + myimgvar
+ '"></a>'
          document.getElementById(el).innerHTML = tag;
     }
</script>

<div id="foo"></div>

<script type="text/javascript">writeTag('foo');</script>

gives you some flexibility as far as reusing the function and writing
the HTML to different areas of the page.


On 8/2/07, Robert Harrison <[EMAIL PROTECTED]> wrote:
>
> Sorry for the OT JS question, but I need this to work and someone my see the
> problem.
>
> I'm creating a function to write a tag with some external variables. I'm
> using document.write, but the < and > symbols in the tag are giving me a
> fit. I tried using &lt; and &gt;, but the browser just displays the tag
> then. It doesn't execute it.
>
> I should be able to do:
>
>     function writetag () {
>         document.write ("<a href="""+myurlvar+"""><img
> src="""+myimgvar+""></a>");
>     }
>
> The do <script language-"javascript">writetag</script>
>
> but it don't work. Anyone have any ideas?
>
> Thanks
>
> Robert B. Harrison
> Director of Interactive services
> Austin & Williams
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.476 / Virus Database: 269.11.2/931 - Release Date: 8/1/2007
> 4:53 PM
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:285260
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to