spewn
Programmer
- May 7, 2001
- 1,034
i had originally built my page and tested on IE...getElementByID was working great, even though i had labeled a majority of my tags as NAME= instead of ID=.
so when it came time to run in Netscape, a majority of my scripts failed. i figured out the problem, and re-labeled all the elements to include BOTH the NAME= and the ID= attributes. (i need the NAME= for cgi purposes)
then i got everything to work great. now i came to a radio button page within my site that isn't working. the original script calls for accessing the radio buttons like so:
getElementById(radioBtn[1]).checked=true;
although this works in IE, Netcape isn't buying it. it says the radioBtn[1] isn't declared, or doesn't exist.
any ideas? i was reading up on this and came across the term getElementByTagName...although the post didn't directly address my problem, it seemed related. is this better to use in terms of wider acceptance (browser-wise)...
another question is: my code below adds (among other things) the new price of a product based on the new value entered into a text field. it then changes the total of the product, plus the updated grand total of all the products. the script works great in IE, and in Netscape it works but only on the individual product total. when it comes to the grand total, it reads $NaN.
maybe you can see a syntax error i missed?!?
since it works in IE, it must be a syntax issue(?)...
thanks!
- g
so when it came time to run in Netscape, a majority of my scripts failed. i figured out the problem, and re-labeled all the elements to include BOTH the NAME= and the ID= attributes. (i need the NAME= for cgi purposes)
then i got everything to work great. now i came to a radio button page within my site that isn't working. the original script calls for accessing the radio buttons like so:
getElementById(radioBtn[1]).checked=true;
although this works in IE, Netcape isn't buying it. it says the radioBtn[1] isn't declared, or doesn't exist.
any ideas? i was reading up on this and came across the term getElementByTagName...although the post didn't directly address my problem, it seemed related. is this better to use in terms of wider acceptance (browser-wise)...
another question is: my code below adds (among other things) the new price of a product based on the new value entered into a text field. it then changes the total of the product, plus the updated grand total of all the products. the script works great in IE, and in Netscape it works but only on the individual product total. when it comes to the grand total, it reads $NaN.
maybe you can see a syntax error i missed?!?
Code:
function valChange(x) {
cartItemQty=eval("document.getElementById('prodQTY"+x+"').value");
cartItemQtySub=eval("document.getElementById('cartItemQtySub"+x+"').value");
cartItemQtyStatic=eval("document.getElementById('cartItemQtyStatic"+x+"').value");
itemQty=eval("document.getElementById('itemQty"+x+"').value");
qtyChange=eval("document.getElementById('cartItem"+x+"').value");
pricePer=eval("document.getElementById('pricePer"+x+"').value");
cartTotal2=eval("document.getElementById('cartTotal').value");
itemPrice=eval("document.getElementById('cartItemPrice"+x+"').value");
newItemTotal=(pricePer*(cartItemQty));//here is product total
newItemPrice=(cartItemQtySub*pricePer);
newItemTotalNum=Number(newItemTotal);
if (cartItemQty!=cartItemQtySub){
newCartTotal=Number(cartTotal2)-Number(newItemPrice)+Number(newItemTotal);//here is grand total
document.getElementById('cartTotal').innerHTML=newCartTotal.toFixed(2);
document.getElementById('cartTotal').value=newCartTotal;
}
eval("document.getElementById('cartItemPrice"+x+"').innerHTML=newItemTotal.toFixed(2)");
eval("document.getElementById('cartItemQtySub"+x+"').value=cartItemQty");
}
since it works in IE, it must be a syntax issue(?)...
thanks!
- g