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!

onChange() Event/function in Netscape not working.

Status
Not open for further replies.

ashpassword

Programmer
Jun 19, 2002
19
IN
Can I use onChage event in Netscape 6 if yes than I am using it for combo, In that what I have done is on the basis of certain selection

I am enabling and disabling the button.
This is working fine in IE but nothing happens in Netscape 6.

For your reference I am sending my code:

function forEnableDisable()
{
var objForm = document.reports; //"reports" is my form name.
var lsDesValue = objForm.cmbDesFormat.value;
if(lsDesValue=="PDF")
{
objForm.btnPrintReport.disabled=true; //"btnPrintReport" is the name of button which I want to disable.
}
else
{
objForm.btnPrintReport.disabled=false;
}
return true;
}

The above function I am calling from combo,as :
<select name=&quot;cmbDesFormat&quot; class=&quot;clselectbox&quot; tabindex = &quot;6&quot; size=&quot;1&quot; onChange=&quot;forEnableDisable();&quot;>
 
your code strcutured in the follwoing way works fine in N6:


<html>
<head>
</head>
<body>
<script>
function forEnableDisable()
{
var objForm = document.reports; //&quot;reports&quot; is my form name.
var lsDesValue = objForm.cmbDesFormat.value;
if(lsDesValue==&quot;PDF&quot;)
{
objForm.btnPrintReport.disabled=true; //&quot;btnPrintReport&quot; is the name of button which I want to disable.
}
else
{
objForm.btnPrintReport.disabled=false;
}
return true;
}
</script>
<form name=reports>
<select name=&quot;cmbDesFormat&quot; tabindex = &quot;6&quot; size=&quot;1&quot; onChange=&quot;forEnableDisable();&quot;>
<option value=&quot;1&quot;>1
<option value=&quot;2&quot;>2
<option value=&quot;PDF&quot;>PDF
</select>
<input name=&quot;btnPrintReport&quot; type=text>
</form>
</body>
</html>


 
Ya I have written in the same manner but instead of sending my whole file which contains html tags and all, I sent u only the function.
but i don't know why it is not working?
 
netscape can be very unforgiving with HTML so make sure all of your HTML is valid for netscape 6.1, this also includes css. I have noticed in the past that bad html can affect scripting on the page, this may be your problem.

also change:
onChange=&quot;forEnableDisable();&quot;>
to
onChange=&quot;forEnableDisable()&quot;>

and also:
tabindex = &quot;6&quot;
to:
tabindex=&quot;6&quot;


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top