P
Prasanna
Friends,
the Javascript function firstChild() works as expected in IE but
returns "undefined" in Netscape 7.1
Here is the sample html code that I used. I am asking the javascript
to print out the id of the child of para1. IE correctly prints the
string "italicsid", but Netscape gives me an "undefined". Why so? Any
help is greatly appreciated.
Thanks,
Prasanna
<html>
<head>
<script LANGUAGE="Javascript">
function GetFirstChild(which)
{
curr = document.getElementById(which);
{
alert(curr.firstChild.id) ;
}
}
</script>
</head>
<body>
<p class=insert id=para1 onclick="GetFirstChild('para1')">
<i id="italicsid" name="italicsname">
Child of para1
</i>
</p>
</body>
</html>
the Javascript function firstChild() works as expected in IE but
returns "undefined" in Netscape 7.1
Here is the sample html code that I used. I am asking the javascript
to print out the id of the child of para1. IE correctly prints the
string "italicsid", but Netscape gives me an "undefined". Why so? Any
help is greatly appreciated.
Thanks,
Prasanna
<html>
<head>
<script LANGUAGE="Javascript">
function GetFirstChild(which)
{
curr = document.getElementById(which);
{
alert(curr.firstChild.id) ;
}
}
</script>
</head>
<body>
<p class=insert id=para1 onclick="GetFirstChild('para1')">
<i id="italicsid" name="italicsname">
Child of para1
</i>
</p>
</body>
</html>