View Full Version : Please hlp: "onChange" in Netscape

Noerd Joeller
07-05-2002, 03:50 PM
I have a form area on my html page (method="post"). Within that form is a default: one widget at $5.00 totals $5.00.

It looks like a textarea with a "1" in it, followed by the word, "widget," followed by a "total" textarea with a "5" in it.

IE uses the JS "onKeyUp," so that when the visitor types in a "2," the total instantly displays a "10" as soon as the key is typed. However, to make this work in Netscape, I have additionally included the JS "onChange" handler.

Here's the problem: When the visitor uses Netscape 4, and they type a "2" in the textarea, the, "5" WON'T UPDATE to a "10" .... UNLESS the visitor clicks anywhere else on the page.

What can be done to make Netscape4 do the same as Explorer?

(by the way, many many people have not upgraded their Netscape4 yet, so that is why I need this fix)

Thank you!

07-05-2002, 04:53 PM
... first thing that comes to mind is "upgrade"...:D :D

Noerd Joeller
07-05-2002, 05:15 PM
I was hoping for help in this forum.

It is easy for us, "technically oriented," "smart people," to keep up on the latest of everything. "Oh golly... Browser version 6.0323 just came out..... I better obsessively upgrade my OLD Browser version 6.0322!!"
In the real world (based on weblogs!), MANY people are still using Netscape 4.

For all you techy types... there is NOTHING more annoying to me than visiting someone's website where they have a "logo" that says, "Best viewed on such and such a monitor, using such and such a browser [and you should wear a hat]

A "good" coder will make their site truly cross-platform, which I have taken the time and effort and hours to do.

I just needed help on this one thing. Could someone possibly help, rather than point out that the whole world should upgrade?


07-05-2002, 06:54 PM
I respectfully disagree with your definition of "good coder". In my view good coder is the one who writes standard compliant code. There are NS6.0+ Mozilla and IE 5+ (still needs some work arounds) that work with HTML4.01

It is not about "best viewed in .... logos" it is about "HTML Valid" logo that says that you have done your job. It will also save you hours of headache and frustration.

You can also help those who are not "technically oriented" like us to keep up with the current tecnology by providing links where they can download the latest browser versions.

Just my 2 cents on development principles, there are a quite a few people here, that I sure will help you with your particular problem. I just offered you an advice how to avoid it all-together.

Oh, BTW, according to The Counter (http://www.thecounter.com/stats/2002/May/browser.php), NS4.0 is used by 4% of population. It may still qualify as MANY people, but are you getting your "return on investment" here?

07-05-2002, 07:35 PM
Navigator supports onkeyup for text controls; onchange is working as it always does, firing after the element loses focus. Post the code that isn't working.

Noerd Joeller
07-05-2002, 08:03 PM
Yes, I know onChange causes it to happen after the user "loses focus." Oh well, I guess the problems not fixable. Thank you anyway.

I cannot believe one reply I got about "upgrading." Yes, most of us DO upgrade, but there are many people who are just learning how to click a mouse. You are in a tiny acrylic box cube of your own if you think posting links all over your page on where to "download upgrades" is going to make a consumer happy, when all the consumer wants to do is get the product ordered. People want things, and they want them now. They don't want to have to stop half way through the order to "download a new browser." Give me a break. You spent all that time philosophising instead of helping me, which is a thorn in my side when it comes to forums. "Oh lets all join hands and make the world a better place by uplifting humanity to the latest browser."

07-05-2002, 08:27 PM
Here's the problem: When the visitor uses Netscape 4, and they type a "2" in the textarea, the, "5" WON'T UPDATE to a "10" .... UNLESS the visitor clicks anywhere else on the page.

Yes, I know onChange causes it to happen after the user "loses focus."

Well...if you knew that already, why would it be a "problem"?

I don't lecture people (generally); there's probably a sensible answer to your question, if you're interested in pursuing it dispassionately.

07-05-2002, 08:52 PM
The "portability versus compliance" debate will never end :rolleyes:

Have you tried using the onKeyUp event to trigger formelement.blur() - that would fire the onchange event and cause the textarea to be updated (I guess - haven't tested it but it sounds plausible)

Noerd Joeller
07-05-2002, 10:36 PM
onkeyup to trigger blur! Now THAT'S the type of idea I'm looking for! Wow!..

Okay, if you would just do one little thing.... please post the code for that.

If you do that, I promise to hold the door open for people more often, smile more, and use, "please and thank you," more often, and in general, be a better person in life.


07-06-2002, 01:22 AM
Now i come to try it, you don't need any of that - onkeyup is enough to do the job:



var wObj,wVal,tObj,tVal;

function calculateTotal(wObj) {

wVal = parseInt(wObj.value);

tVal = wVal * 5;
tObj = document.forms["widgetform"]["totalarea"];

tObj.value = tVal;



<form name="widgetform">
<td><textarea name="widgetarea" onkeyup="calculateTotal(this)">1</textarea></td>
<td>widget : total = </td>
<td><textarea name="totalarea">5</textarea></td>