473,378 Members | 1,334 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,378 software developers and data experts.

Firefox problem with .value

Does anyone know how I can fix the code below to work in Firefox,it
works perfectly well in IE, the problem is that I have to use Firefox
for this assignment.

Thankyou

Michael

<html>
<body>

<p>Please enter the type of book that you wish to purchase:</p>
<select name="hardback"
onchange="if(this.selectedIndex)cover=+(this[this.selectedIndex].value);">
<option value= "0" SELECTED> Select Type of Book--(Default
Paperback)</option>
<option value="4.00">Standard Hardback</option>
<option value="6.00">Limited Edition HardBack</option>
</td>
<td>
<form>
<INPUT TYPE="BUTTON" VALUE='reset'onClick='hardback.value=0'>
</form>
</body>
</html>
Jul 23 '05 #1
3 1299
mi*****@hotmail.com (MickG) writes:
Does anyone know how I can fix the code below to work in Firefox,it
works perfectly well in IE, the problem is that I have to use Firefox
for this assignment.
You forgot to tell us what it should do.
<p>Please enter the type of book that you wish to purchase:</p>
<select name="hardback"
onchange="if(this.selectedIndex)cover=+(this[this.selectedIndex].value);">
This select element is not inside any form. That makes it hard to refer to
it. You can't go through the document.forms collection, and it doesn't
have an id.
<form>
The form needs an action to be valid.
<INPUT TYPE="BUTTON" VALUE='reset'onClick='hardback.value=0'>
There is a space missing between the VALUE and onClick attributes.
You are referring to "hardback" here. There is no global variable
declared of that name. IE might create global variables referring
to named elements, but as you can see, other browsers don't. So,
you need some way of referring to the select with name="hardback".
</form>


My suggestion: put the select in the same form as the button. Then
refer to it as:
onclick="this.form.elements['hardback'].value = 0;"
(or just make the button an <input type="reset">).

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #2
thanks for the help, it works perfectly now.

Michael

Jul 23 '05 #3
Lee
MickG said:

Does anyone know how I can fix the code below to work in Firefox,it
works perfectly well in IE, the problem is that I have to use Firefox
for this assignment.

Thankyou

Michael

<html>
<body>

<p>Please enter the type of book that you wish to purchase:</p>
<select name="hardback"
onchange="if(this.selectedIndex)cover=+(this[this.selectedIndex].value);">


IE often makes guesses if your code is missing something.
Sometimes the guess is correct, and it "works perfectly well":

if(this.selectedIndex)cover=+(this.options[this.selectedIndex].value)

Jul 23 '05 #4

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

Similar topics

3
by: TJS | last post by:
I am finding that the serverside requiredvalidator doesn't fire in the firefox browser, and user request proceeds through to my updateProfile method. Validation is working correctly in the IE...
4
by: Jake Barnes | last post by:
I wanted to teach myself AJAX this weekend so I sat down with Stuart Landgridge's book and I started to play around. I came up with a little page that you can add text and images to. You can see it...
7
by: Coder | last post by:
Hi I have the following code in java script, it is not giving proper output in FIREFOX but running fine in IE... can anybody help me out to make this run in FIREFOX . <script...
11
by: davecph | last post by:
I'm constructing a website with a layout created with div-tags. They have a fixed width, float left, and display inline. When one of the div's contain a select-element the right-most div floats down...
3
by: SAL | last post by:
Hello, I did google this issue and found some stuff related to BrowserCaps section of either web.config or machine.config but it didn't work. It seems that most pages in my webapp are okay but a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.