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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

radio checked, then layer change

Status
Not open for further replies.

achai

MIS
May 23, 2000
71
US
something wrong with this javascript. help. thanks
-------
<HTML>
<HEAD>
<TITLE>DDC Buttons</TITLE>
<SCRIPT>
function ButtonPress(buttonnumber) {
document.layers.cust.document.write('data'+buttonnumber);
}
</SCRIPT>
</HEAD>
<BODY>
<table>
<tr><td><input type=&quot;radio&quot; name=&quot;test&quot; onclick=&quot;ButtonPress(1);&quot;>Button 1
<BUTTON onclick=&quot;ButtonPress(2);&quot;>Button 2</BUTTON>
<BUTTON onclick=&quot;ButtonPress(3);&quot;>Button 3</BUTTON>
<input type=&quot;radio&quot; name=&quot;test&quot; onclick=&quot;ButtonPress(4);&quot;>Button 4</td></tr>
<tr><td><span id=cust style=&quot;position:relative&quot;></span>
</td></tr>
</table>
</BODY>
</HTML> [sig][/sig]
 
There is much wrong pieces.
First: <button> tag supported only on IE.
Second: layers object supported only in Netscape
Third: In Netscape ANY (in your case radio) form element need to be enclosed in <form> tag (may be without attributes) [sig]<p>Michael Dubner<br>Brainbench MVP/HTML+JavaScript<br>
[/sig]
 
i delete <button> now, and add <form>
change javascript to
---
function ButtonPress(buttonnumber) {
if (document.layer){
document.layers.cust.document.write('data'+buttonnumber);
}
if (document.all){
document.innerhtml=buttonnumber;
}
}
</SCRIPT>
---------
now it only works in IE, not in Netscape. but you mentioned layer works in netscape.

[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top