using the client side "onchange" event function

  • Thread starter Thread starter Norm via DotNetMonster.com
  • Start date Start date
N

Norm via DotNetMonster.com

I have an onchange event which fires when the content of an HTML textbox
changes. My problem is that when I try to compare the content of this textbox
with another HTML textbox using an if statement, I get a Page Error and my
code fails. This has got to be a no brainer. Any help out there for a
clueless newbie?

This works:
function ow8t_onchange()
{
alert("success");
}

This crashes:
function ow8t_onchange()
{
if(crw8t.value != ow8t.value)
{
alert("success");
}
}
 
try
function ow8t_onchange()
{
if(document.formname.crw8t.value <> document.formname.ow8t.value)
{
alert("success");
}
}

replace forname with whatever form name you use..
rgds
dave
 
or use

document.getElementById("crw8t").value

This makes your code a little more generic since it does not rely on the
name of the form.

regards

Daniel


dave said:
try
function ow8t_onchange()
{
if(document.formname.crw8t.value <> document.formname.ow8t.value)
{
alert("success");
}
}

replace forname with whatever form name you use..
rgds
dave
 
This works - although with !=,not <> - thanks so much!

Norm
try
function ow8t_onchange()
{
if(document.formname.crw8t.value <> document.formname.ow8t.value)
{
alert("success");
}
}

replace forname with whatever form name you use..
rgds
dave
I have an onchange event which fires when the content of an HTML textbox
changes. My problem is that when I try to compare the content of this
[quoted text clipped - 17 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top