Thread: document.write question
Results 1 to 6 of 6
12-03-2003, 04:03 PM #1
Right now I'm working on a project that I may put on an intranet server for departmental use.
What I have is a main menu:
I've set up the markup the same:
CONTENT information and STUFF HERE UNIQUE TO EACH PAGE
and in submenu.js I can put in the links for the menu and it works fine for the first seven links, but adding an eighth I get the script error:expected ')'error. I might eventually need two or three lines of links (hence the desire to edit in one place).
Each links markup is like:
<a href="whatever.html" onclick="window.open(this.href);return false;">Website</a>
I'm still searching for the answer, but if anybody has any input, it would be appreciated.
12-03-2003, 07:45 PM #2
probably would need to see the submenu.js
12-04-2003, 09:19 PM #3
Figured it out all by myself.....
Did you know that an apostrophe and a slash can't be used in the text of an anchor? Like:
<a href="whatever.html">Some O/S's</a>
I didn't That's why it thought it didn't get the expected ')' ....it thought I had closed the string. Cool....
Now my question is:
Again, probably something simple that I can't find right now......
Or, is this a case of live and learn for me....
12-05-2003, 02:34 AM #4
You can escape ' in js like this -
12-05-2003, 12:42 PM #5
LOL I thought I had read something like that somewhere a long time ago, so I tried it first thing this morning. BINGO. Sometimes I scare myself........
For the sake of the thread, I'll provide a couple of examples:
<a href="operating systems.html">O/S's</a> <a href="utilities.html">M/GRCV's</a>
[b]document.write('<a href="operating systems.html">O\/S\'s</a><a href="utilities.html">M\/GRCV\'s</a>')
Is there a list of characters somewhere where this applies? Or is it safe to assume that it applies to anything that isn't alpha-numeric?
12-05-2003, 01:07 PM #6