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 7899059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:36:05+00:00 2026-06-03T08:36:05+00:00

I was testing some code on the tryit editor and was unable to replicate

  • 0

I was testing some code on the tryit editor and was unable to replicate functionality when I save the code locally and was wondering it anyone had any ideas as to why this seems to happen.

The code snippet is

<html>
<head>
<script type="text/javascript" src="http://www.w3schools.com/dom/loadxmldoc.js"></script>
</head>
<body>  
<script type="text/javascript">
xmlDoc=loadXMLDoc("http://www.w3schools.com/dom/books.xml");
for (j=0;j<xmlDoc.getElementsByTagName("book").length;j++ )
{
    x=xmlDoc.getElementsByTagName("book")[j].childNodes;
    y=xmlDoc.getElementsByTagName("book")[j].firstChild;
    for (i=0;i<x.length;i++)
    {
        if (y.nodeType==1)  
        {
            //Process only element nodes (type 1)  
            document.write(y.nodeName + " : " +x[i].childNodes[0].nodeValue + "<br />");  
        }
        y=y.nextSibling;
    }
}
</script>
</body>
</html>

Can someone tell me what I’m doing wrong here

Many thanks in advance

Edit: Thanks to all for the w3schools tip. I think I abuse the tryit more than I should stop doing so

  • 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-03T08:36:06+00:00Added an answer on June 3, 2026 at 8:36 am

    You are probably running into the same origin policy here.

    Try saving the XML-file locally and load it from there instead of the remote server of w3schools.

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

Sidebar

Related Questions

I put a breakpoint in javascript and am testing some code with Chrome. I
For some testing code, I'd like to be able to host a WCF service
Here is some testing code: <script> var movieList = new Array(); var friendList= ;
I am starting to write some code for A/B testing in a Grails web
All, I'm trying to do some unit testing in some archaic java code (no
I'm doing some unit testing, and some of the code is checking to see
Sometimes for testing/developing purposes we make some changes in the code that must be
I was testing Thrift on java, but this code give me some errors.. ClientVoiceToTextHandler
I'm testing some legacy code that extends the default php exception object. This code
I am testing out some memcache code here in PHP: 1: $testInstance = new

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.