I have a script tag with ‘A’ variable and has been initialised as 16 but when I use alert on IE under onclick event, I received undefine rather than 16.
Is this the problem in IE 6?
e.g.
<script type="text/javascript">
var A =16;
</script>
<a href="" onclick="javascript:alert(A);">undefine</a>
I’d bet on it being caused by some slight confusion…
Being that putting var in front of a variable puts that variable into the local scope only in Javascript, and a variable delcaration without it (a = 16) is global.