Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code does not work in Internet Explorer, but it does in FireFox

Status
Not open for further replies.
Jun 20, 2003
6
US
This is code allows for what is selected in Drop-Down boxes to appear in a text box next to it, if they select a second thing, it will also appear in that text box, it works in Firefox, but not Internet Explorer.

<script>
function addOption(x,x2) {
sOption=document.getElementById(x2).value;
sOptions=sOption.split("\n");
if (sOption == '') {document.getElementById(x2).value=x+"\n";}
else { if (sOptions.length > 1) {document.getElementById(x2).value=sOption+x+"\n";}
else {document.getElementById(x2).value=sOption+"\n"+x+"\n";}
}
document.getElementById(x2).focus();
}
</script>
 
I tried this little test in IE6 and it works:

Code:
<html>
<head>
<script>
function addOption(x,x2) {
sOption=document.getElementById(x2).value;
sOptions=sOption.split("\n");
if (sOption == '') {document.getElementById(x2).value=x+"\n";}
else { if (sOptions.length > 1) {document.getElementById(x2).value=sOption+x+"\n";}
else {document.getElementById(x2).value=sOption+"\n"+x+"\n";}
}
document.getElementById(x2).focus();
}
</script>
</head>
<body>
<textarea id='myText' cols='75' rows='25'>
</textarea>
<select onchange="addOption(this.value, 'myText')">
<option value='_'>Choose...</option>
<option value='My dog has fleas'>dog</option>
<option value='My dog has flease'>sheep</option>
</select>
</body>
</html>

I hope there's something useful in this for you.

--Dave
 
Nothing! I copied and pasted your function as is. Did you try my sample code in IE? What version of IE are you using?

--Dave
 
6.0, but thats also a proble with AOL, seeing as they use IE.


The code does not work when in real practice, apparently.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top