Click to See Complete Forum and Search --> : Run out of quotes


IxxI
05-18-2003, 03:54 PM
I have a line that looks something like this:

<div id="link1" class="links" onmouseover="colchng('link1'); over(); this.timeoutID=window.setTimeout('moveout();', 500); window.clearTimeout(this.timeoutID3);" onmouseout="bckchng('1'); out(); window.clearTimeout(this.timeoutID); this.timeoutID2=window.setTimeout('moveback()', 500)">

and I wish to put it in a document.write("") statement. However as you can see I'm using both types of quotes so I don't know what to do to delimit the sentence, as either type of quote gets cut off before I want it to (if that makes sense).
Thanks

IxxI

AdamGundry
05-18-2003, 04:03 PM
You can escape quotes using the backslash character (\), for example:

document.write("Some \"quoted\" text");

Adam

leechun
05-18-2003, 04:25 PM
i think you can do like:

document.write('<div id="link1" class="links" onmouseover="colchng('link1'); over(); this.timeoutID=window.setTimeout('moveout();', 500); window.clearTimeout(this.timeoutID3);" onmouseout="bckchng('1'); out(); window.clearTimeout(this.timeoutID); this.timeoutID2=window.setTimeout('moveback()', 500)">');

//then

document.write('</div>');

i have just done something similar to what you mean, perhaps you can take a look and see if it any useful to you it at

www.sonicvariable.com

in the "collabrative" page

i am a bit new to JS, so i am not garantee my method in terms of their "correctness". but they works at least.

havik
05-18-2003, 11:08 PM
This will work:

document.write("<div id=\"link1\" class=\"links\" onmouseover=\"colchng('link1'); over(); this.timeoutID=window.setTimeout('moveout();', 500); window.clearTimeout(this.timeoutID3);\" onmouseout=\"bckchng('1'); out(); window.clearTimeout(this.timeoutID); this.timeoutID2=window.setTimeout('moveback()', 500)\">");

using document.write('<div id="link1"... will work but you'd need backslashes (\) placed before any single quotation (') within the outside single quotations, so essentially its the same as the one above.

Havik

IxxI
05-19-2003, 06:36 AM
Thanks everyone, the \ escaping the quotes was what I was looking for.

IxxI