Jump to content

Firefox Won't Change Button Value...


Anza Power

Recommended Posts

Hello, I wanted to use a function that will make my next riddle site look really great and user friendly, but for that I needed to use the function, let's say you have a button called B1 on the page, and with value of "1", you go to another button on the page and change it's onClick="" command to onClick="B1.value='2'", it worked in IE 6, but when I wanted to use it in Firefox it got emo...Here's a sample:http://www.freewebs.com/anzapower/Buttonsample.htmTry it in Internet Explorer and in Firefox if you have it or any other browser and tell me what you see...:)If there's no way to make it work in Firefox I think I'll just have to create a mirror webpages for Firefox users that will use other functions in it like changing an image's source but that won't look as good as the original idea would have...

Link to comment
Share on other sites

That code is ancient. IE is probably the only browser that will run it. But any code you write that will work in Firefox will ALSO work in IE6, so don't go messing with "mirror pages."Start by giving your button an id. Now, read about this: http://www.w3schools.com/HTMLDOM/met_doc_getelementbyid.asp There is even an example you can play with. For your application, you'll want to reference the .value property instead of the .innerHTML property.

Link to comment
Share on other sites

^ Well yeah what I did reference is the value property and the onClick property, but anyways another friend of mine has already told me about giving id's to the buttons instead of names (just change name="B1" to id="B1") and all works perfectly, thanx anyways. :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...