473,396 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

using the client side "onchange" event function

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");
}
}
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200506/1
Nov 19 '05 #1
3 1517
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

"Norm via DotNetMonster.com" <fo***@nospam.DotNetMonster.com> wrote in
message news:4F***********@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");
}
}
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200506/1

Nov 19 '05 #2
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" <fo****@foo.netREMOVE> schrieb im Newsbeitrag
news:OD**************@TK2MSFTNGP10.phx.gbl...
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

"Norm via DotNetMonster.com" <fo***@nospam.DotNetMonster.com> wrote in
message news:4F***********@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");
}
}
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200506/1


Nov 19 '05 #3
This works - although with !=,not <> - thanks so much!

Norm

dave wrote:
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]
}
}

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200506/1
Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Lee Mundie | last post by:
Hi there, Simple problem here but can't seem to fix it! Okay, I have a select list from which people choose avatars... the list is option values ie. <option>Worm</option> ...
1
by: José Carlos | last post by:
Hi. I have an array with mysql´s data. I have used this array with several text box in a formulary. My question is: How could i use the event onchange to make a function which update the...
3
by: Santosh | last post by:
Hi, I have a requirement in which, I need to capture a loan amount and the amount of down payment for that loan. According to the requirement, the user is going to enter enter the loan amount and...
3
by: websphereguru | last post by:
I Have a text box in a jsp that is pre populated. The text box should accept only numbers and it should be greater than a minimum value (this value depends on the user settings). If the user enters...
4
by: Zeebra3 | last post by:
Here goes: I have a web form with several asp:dropdownlists, with which, when selection is changed I want to fire an event defined in some clientside js. The content of the clientside code is...
3
by: jab3 | last post by:
Hello. I"m new to this group, and to JavaScript in general, so please forgive me if I breach local etiquette. I'm trying to implement some client-side 'dynamic' validation on a form. I'm having...
3
by: itp | last post by:
I have moved to Matt Kruse's Javascript Toolbox. It has some great examples to get you going quickly! Unfortunately all the examples are based on a form/submit model. I would like to try using...
7
by: robtyketto | last post by:
Greetings, I'm slowly building up code to do the following:- Display TWO selection option boxes (cascading). If the FIRST selection option box changes then reload the jsp using onchange...
1
by: ruds | last post by:
Hello, I have a JSP page in which HTML form elements are present. I have a drop down list named Country, when a user selects his country I want another drop down list to populate based on the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.