Click to See Complete Forum and Search --> : Need help on small IE JScript to Netscape


sunmade
04-12-2003, 11:27 AM
Hi all.

I have the following script that works in IE and Opera, but not in Netscape.

Can anybody help me on changing it so it works in Netscape?
Thank you so much!
chris


function load()
{
window.status = "Made by Ville Leivo 15.07.2002"
}

function count()
{
var item1price = 100;
var item2price = 100;
var item3price = 100;
var item4price = 100;

// kortti
if (calc.item1.checked){
var witem1 = document.calc.item1.value = item1price;
} else {
var witem1 = document.calc.item1.value = 0;
}

if (calc.item2.checked){
var witem2 = document.calc.item2.value = item2price;
} else {
var witem2 = document.calc.item2.value = 0;
}

// www-sivut
if (calc.item3.checked) {
var witem3 = document.calc.item3.value = item3price;
} else {
var witem3 = document.calc.item3.value = 0;
}
if (calc.item4.checked) {
var witem4 = document.calc.item4.value = item4price;
} else {
var witem4 = document.calc.item4.value = 0;
}
document.calc.pay.value = witem1 + witem2 + witem3 + witem4;
}

khalidali63
04-12-2003, 11:41 AM
it would have been easier to understand if you posted your corresponding html

:-)

Cheers

Khalid

AdamGundry
04-12-2003, 12:01 PM
Whenever you use this
document.calc.item1.value

you need to use this
document.getElementById('item1').value

Adam

sunmade
04-12-2003, 12:33 PM
Hi Adam

thanks for your help.

But I get the following error message:

Error: document.getElementById("item1") has no properties
Source File: file:///Macintosh%20HD/clients/calculateNS.js
Line: 13


Any ideas?
Can you take another look at the script?

Thanks a lot!

Jona
04-12-2003, 12:46 PM
Try changing, "name" to "id" in the attribute of it.

sunmade
04-12-2003, 12:57 PM
Hello Jona and all the others that helped

Thank you very much for you kind and fast help!!

changing 'name' to 'id' and the 'document.getElementById('item1')'

sunmade
04-12-2003, 12:58 PM
oops, my reply got cut off.
anyway, all your tips and tricks worked for me.

thanks a lot Khalid, Adam and Jona.