180
rated 0 times
[
185]
[
5]
/ answers: 1 / hits: 25776
/ 12 Years ago, tue, october 16, 2012, 12:00:00
I am working from the book Simply JavaScript and there is an example on pages 68-69 that I cannot get to run. I have copied it from the book and I am working with a fellow student. I think there must be a coding error in the example and was hoping someone could look it over real quick and give us some guidance.
From what I understand the script should cause an alert box to pop up and display the node name (which according to the book should just be a
)
Here is the HTML
<!doctype html>
<head>
<script type=text/javascript src=script.js></script>
<meta charset=utf-8>
<title>
Stupid Title
</title>
</head>
<body>
<h1>
Sniper (1998)
</h1>
<p>
In this cinema masterpiece
<a id =berenger href=name/nm0000297/>tom Berenger</a> plays a us soldier working in the Panamanian Jungle.
</p>
</body>
And here is my JavaScript
alert(AAAAAAAAAAAAAAHH);
var target = document.getElementById(berenger);
if (target != null)
alert(target.nodeName);
This is my second week of javascript class so I'm pretty new with it.
More From » html