[Javascript] My code works in IE, not in Netscape, please help
Yi Li
yili1998 at yahoo.com
Mon Apr 23 12:02:19 CDT 2001
Hi, Everyone:
I try to create a stationary, all names in
<select></select>, when select a name, other input box
pop up correct mail address. My code works in IE, but
not in Netscape, please help with following code:
-------------------------------------------------------
<HTML>
<HEAD>
<TITLE>Stationary</TITLE>
<SCRIPT LANGUAGE="JavaScript1.2">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
function chooseName()
{
if (document.mailinfo.name.value == "Bunny Bug")
{
document.mailinfo.address.value = "12345 Sunny
Drive";
document.mailinfo.city.value = "Farmland";
document.mailinfo.state.value = "MS";
document.mailinfo.zip.value = "39180";
document.mailinfo.dear.value = "Ms. Bunny Bug:";
}
else if (document.mailinfo.name.value == "Donld
Dock")
{
document.mailinfo.address.value = "56789 Beverly
Lane";
document.mailinfo.city.value = "San Jose";
document.mailinfo.state.value = "CA";
document.mailinfo.zip.value = "95121";
document.mailinfo.dear.value = "Mr. Donld Dock:";
}
else
{
document.mailinfo.address.value = "111213 E.
Watcher Dr.";
document.mailinfo.city.value = "Topsy";
document.mailinfo.state.value = "UT";
document.mailinfo.zip.value = "84121";
document.mailinfo.dear.value = "Mickey Mouse:";
}
}
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</SCRIPT>
</HEAD>
<BODY bgcolor=#FFFFCC>
<FONT face="verdana">
<H1 align="CENTER">My Stationery</H1>
<HR>
<FORM NAME="mailinfo">
Name:<BR>
<SELECT NAME="name" onChange="chooseName( );">
<OPTION VALUE="0">--- Select Name ---
<OPTION VALUE="Bunny Bug">Bunny Bug
<OPTION VALUE="Donld Dock">Donld Dock
<OPTION VALUE="Mickey Mouse">Mickey Mouse
</SELECT><BR>
Address:<BR>
<INPUT TYPE="text" NAME="address" SIZE=30><BR>
City, State, Zip:<BR>
<INPUT TYPE="text" NAME="city" SIZE=15>
<INPUT TYPE="text" NAME="state" SIZE=2 MAXLENGTH=2>
<INPUT TYPE="text" NAME="zip" SIZE=5
MAXLENGTH=5><BR><BR><BR>
Dear:<BR>
<INPUT TYPE="text" NAME="dear" SIZE="15"><BR>
Letter:<BR>
<TEXTAREA NAME="letter" COLS=50 ROWS=10>
Enter any words here
</TEXTAREA><BR><BR>
<INPUT TYPE="reset"><BR><BR>
</FORM>
<NOSCRIPT>
Your browser does not support JavaScript.<BR>
</NOSCRIPT>
<BR>
</FONT>
</BODY>
</HTML>
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
More information about the Javascript
mailing list