Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quotes in document.write string

Status
Not open for further replies.

Albuckj2

Programmer
Jan 7, 2003
68
0
0
GB
Hi,

I am writing some JavaScript to write out some HTML, and have come unstuck when trying to do a link. In the line below, the element that is in majors needs to be enclosed with quotes when passed as a parameter to the function 'explain', but I can't see any way to do it cos document.write takes " as a special character.

Any ideas????

document.write ('<a href=&quot;javascript:explain(' + majors[f] + ');&quot;>');
 
use the escape char

\&quot;



_________________________________________________________
for the best results to your questions: FAQ333-2924
[sub]01001111 01101110 01110000 01101110 01110100[/sub]
onpnt2.gif
[sup] [/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top