createElement() is another way to... well... create elements :-p ..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com
-----Original Message----- From: Jim Davis [mailto:[EMAIL PROTECTED] Sent: Thursday, August 02, 2007 3:35 PM To: CF-Talk Subject: RE: Java Script Question > -----Original Message----- > From: Robert Harrison [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 02, 2007 1:58 PM > To: CF-Talk > Subject: OT: Java Script Question > > > 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 < and >, 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>"); > } In JavaScript you escape special characters with the backslash: document.write ("<a href=\"" + myurlvar + "\"><img src=\"" + myimgvar + "\"></a>"); Note that you can also often simplify this by just using single quotes: document.write ("<a href='" + myurlvar + "'><img src='" + myimgvar + "'></a>"); > The do <script language-"javascript">writetag</script> Here you would need parenthesis to indicate that you're calling a function: <script language-"javascript">writetag();</script> > but it don't work. Anyone have any ideas? That should do it I think - give 'er a shot. Jim Davis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ColdFusion 8 - Build next generation apps today, with easy PDF and Ajax features - download now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:285330 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

