Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8674177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:38:38+00:00 2026-06-12T19:38:38+00:00

I am working from the book Simply JavaScript and there is an example on

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:38:40+00:00Added an answer on June 12, 2026 at 7:38 pm

    The DOM isn’t ready at this point:

    <script type="text/javascript" src="script.js"></script>
    

    Move that line to the end of <body>

    Read about those kind of issues in this docs

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get a simple example working from an assembly book I
I'm working from a JavaScript book and would like to create some menus using
I have been working on the following problem from this book . A certain
I'm trying to dynamically create a book from code server-side. That part's working fine,
I am working on an example from a php book and am getting an
I got the chat example working from Atmosphere, and now I want to get
I'm trying to get the following simple Delegate example working. According to a book
I'm very new to backbone but I manage to get it working from tutorial.
It seems to me that Response.Cache.SetVaryByCustom(mykey); is not working from within ASCX User Controls.
I'm working through a code listing from a book and it has a pair

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.