Embedding JavaScript Within JavaScript
by Ben Ocean <lists(at)TheWebsons.com>
|
Date: |
Mon, 30 Oct 2000 08:43:02 -0800 |
To: |
hwg-techniques(at)hwg.org, javascript(at)LaTech.edu, darrell(at)webctr.com |
|
todo: View
Thread,
Original
|
|
Hi;
I have a PHP page that writes another PHP page on the fly with a JavaScript
page that can be written on the fly embedded within it. Everything works
fine *except* when I try to embed JavaScript within the dynamically
generated JavaScript page. For example, when I code
var newPage = "../index.php3?name=".concat(stuff);
newWindow =
window.open(newPage,"","toolbar=1,menubar=1,width=800,height=600,scrollbars=1,status=1,location=1,directories=1,left=0,top=0");
...blah, blah, blah...
newContent += "eval('frames[" + "'writeHere'" + "].location.href = ' +
stuff + '.src');"
...blah, blah, blah...
newContent += "<span class='solana'><a href='../Solana.html'
onMouseOver='writer(" + "'solana'" + ")'><b>Solana</b></a><sup><font
size=-1>®</font></sup></span>"
...blah, blah, blah...
I get for those last two lines of script the following on the dynamically
generated page:
eval('frames['writeHere'].location.href = ' + stuff + '.src')
<span class='solana'><a href='../Solana.html'
onMouseOver='writer('solana')'><b>Solana</b></a><sup><font
size=-1>®</font></sup></span>
Clearly, the problem is in the nested single quotes. But how do I nest
double quotes within single quotes while dynamically generating the page
when JavaScript parses double quotes???
TIA,
BenO
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA