Forum Moderators: open

Message Too Old, No Replies

Drop down menu not working

         

moishe

11:23 pm on Jan 25, 2006 (gmt 0)

10+ Year Member



This ccode is supposed to give me a drop down menu that allows a user to pick an OS resulting in repair instructions, unfortunately I keep getting an error. Any one bored who would like to take look and see if you see any mistakes...?

Thanks

<script language="javascript" type="text/javascript">  
function selector(oschoose) {
var x=document.getElementById('cell1')
switch(oschoose) {
case 0:
x.innerHTML= ""
y.innerHTML=""
z.innerHTML=""
x.className=""
y.className=""
z.className=""
break;
case 1:
x.className="cardbad"
y.className="cardgood"
z.className="cardwarn"
x.innerHTML="Windows 9x/ME"
y.innerHTML="<b>Windows 98<\/b>, <b>RR Self-Install<\/b>, <b>High-speed Installer<\/b>"
z.innerHTML="<font size=2>
<ol>
<li>Ensure that no programs are running.
<li>Right-click on Network Neighborhood (My Network Places under
WinME), then click on Properties to go to Network Properties.
<li>Remove each entry of TCP/IP by left-clicking once, then clicking
the Remove button.
<li>Once they're all gone, click OK. Windows will then process a few
files, and request a reboot; click No to return to the desktop.
<li>Click on Start, then Run. Type in <b>regedit<\/b>, and click Ok
to enter the Registry Editor.
<li>The path to follow here is HKEY LocalMachine - System -
CurrentControlSet - Services - Winsock2. Delete <b>only<\/b>
the Winsock2 folder.
<li>Also delete HKEY LocalMachine - System - CurrentControlSet -
Services - VxD - Winsock2. Delete <b>only<\/b> the Winsock2
folder.
<li>Reboot the computer.
<p class=standout><b>NOTE:<\/b> If there is an active antivirus
product running, it may generate an error message about missing
TCP/IP, click OK or Cancel to finish the reboot.<\/p>
<li>After reboot is complete, click on Start, then Settings, then
Control Panel.
<li>Inside Control Panel, double-click on Network to return to
Network Properties.
<li>Click on Add, then select Protocol, and click on Add again.
<li>Windows will ask for a Manufacturer and Type of protocol; select
Microsoft as the manufacturer, and TCP/IP as the type. This will
recreate the entries removed earlier.
<li>Click Ok. Windows should request some files from the Win98 cd;
if this is an OEM computer, point Windows at the pre-made
directory on the hard drive <b>C Windows Options Cabs<\/b>,
otherwise use the location of the cdrom drive (ie. <b>E Win98<\/b>).
Once Windows has the files needed, it will request another
restart. This is ok to do, since you will not need to recreate
the key deleted from the Windows Registry earlier.<\/ol>
<\/font>"
break;
}
}
</script>

[edited by: DrDoc at 10:51 pm (utc) on Jan. 26, 2006]
[edit reason] Stripping code to bare minimum [/edit]

moishe

8:58 pm on Jan 26, 2006 (gmt 0)

10+ Year Member



anyone?

DrDoc

10:44 pm on Jan 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can't put line breaks in your JavaScript strings.

moishe

11:23 pm on Jan 26, 2006 (gmt 0)

10+ Year Member



Thanks Doc

Bernard Marx

11:31 pm on Jan 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can, if you're careful.
I've been doing a fair amount of SQL in ASP recently. Rather than putting queries on one line, or concatenating, I've been using this format - backslashing line ends.

It's neater, and easier to create a macro for (although it does send the DB server some extra whitespace)


var RS = DB.execute(
"SELECT colour, curvature \
FROM Fruit \
WHERE type='banana'"
);

Back to the problem as a whole. I think this would be more easily done by having all the content in two static containers, and toggling their display. Messing with innerHTML always feels a little too brutish.

DrDoc

2:41 am on Jan 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The original example contained an additional 4 "containers", hence the innerHTML stuff. But I stripped it down, since they are all essentially the same, except for differing content.

Sorry for the confusion :)

But, back to the suggestion about backslashing line breaks. Although that works (as in "does not produce an error") it does not do what you would expect.

<script type="text/javascript">
alert("testing\
line\
breaks")
</script>

Instead, for the above example, you would want to do something like:

<script type="text/javascript">
alert("testing\n\
line\n\
breaks")
</script>

... which now is no longer as clean as we would like :)