Forum Moderators: open

Message Too Old, No Replies

document.getElementById("syst").value problem with IE6.0

         

Superstition Free

6:55 pm on Aug 22, 2007 (gmt 0)

10+ Year Member



Hi All,

The code below works fine using FireFox, but does not work with IE6.0. I haven't tested with anything else.

document.getElementById("syst").value returns the correct value using FireFox. It returns nothing using IE6.0.

The problem is commented in the JavaScript function below.

I'm basically trying to append a parameter to a URL.

Any help is appreciated. My code indents didn't post. Sorry.
Thanks

<!-- HTML -->
<table border="2" width="730" height="50" cellspacing=5 cellpadding=8; style="font-family:verdana; font-size:125%">
<tr>
<td bgcolor="#115B99"><font color="#FFFFFF">
Choose System
</td>
</tr>
<tr>
<td>
<select NAME=syst id="syst">
<option>Production</option>
<option>Quality</option>
</select>
</td>
</tr>
</table>
:
:
<table border="2" width="730" height="50" cellspacing=5 cellpadding=8; style="font-family:verdana; font-size:125%">
<tr>
<td><A HREF="javascript:OpenURLwithParams('http://blah.blah.com/~blah/GSP/gsp_prmsap_joblog.php', 'N')">Batch Job Log</A> - Summary information for each interface job executed (past 14 days activity)</td>
</tr>
</table>

<!-- JavaScript -->
<script language="JavaScript" type="text/javascript">
function OpenURLwithParams(linkName, withLines)
{
// For the document.getElementById("syst").value...
// FireFox returns either "Quality" or "Production"
// IE returns "" (blank)
$system = document.getElementById("syst").value;
alert("system is " + $system);

if (withLines == "Y") {
defaultLines = "100";
zurl = linkName + "?lines=" + defaultLines + "&system=" + $system;
}
else {
zurl = linkName + "?system=" + document.getElementById("syst").value;
}
self.location = zurl;
}
</script>

Trace

7:21 pm on Aug 22, 2007 (gmt 0)

10+ Year Member



Your dropdown list doesn't have any values, change it to this;
<select name="syst" id="syst">
<option value="Production">Production</option>
<option value="Quality">Quality</option>
</select>

Your Js seems fine.

[edited by: Trace at 7:21 pm (utc) on Aug. 22, 2007]

Superstition Free

7:29 pm on Aug 22, 2007 (gmt 0)

10+ Year Member



Thanks Trace. That fixed it!

I also just found that this code below also works, although I'm using your suggestion instead, as it seems to be the correct way to do it.

var x = document.getElementById("syst");
$system = x.value;

Thanks Again!