Forum Moderators: open

Message Too Old, No Replies

Newbie question

         

Giles Palmer

5:27 pm on Nov 7, 2003 (gmt 0)

10+ Year Member



I am trying to get the value of a text node on a page.
The exact html is as follows.

<TD ID=shoppingBasketOrderTotalCell>£15.43</TD>

I would like to be able to get the £15.43 value.

This is my script code...

var theBasketTotalNode =document.getElementByID("shoppingBasketOrderTotalCell");
var orderVal=theBasketTotalNode.firstChild.nodeValue;

However all I get is a script error in IE 5.2 for the Mac

What am I doing wrong? I am sure it is something very obvious but I can't just find what!

Thanks

piglet

8:27 pm on Nov 7, 2003 (gmt 0)



Hi,

You just have a typo - capitalisation problem.

If this doesn;t work then the problem is within the Mac version of IE - it's notoriously buggy. This works in PC IE and decent browsers like Mozilla/Firebird

<html><body>
<table><tr><TD ID="shoppingBasketOrderTotalCell">£15.43</TD></tr></table>
<script>
var theBasketTotalNode = document.getElementById("shoppingBasketOrderTotalCell");
var orderVal=theBasketTotalNode.firstChild.nodeValue;
alert(orderVal)
</script></body></html>