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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:25:15+00:00 2026-06-02T19:25:15+00:00

Im trying to create a HTML table with links from a XML file using

  • 0

Im trying to create a HTML table with links from a XML file using javascript. The html tbale works fine but when it comes to the link creation it seems the links only have the first word of my string in the link. IF i do an alert(String) command i get the full string but as soon as i try to make an HTML LINK it only adds the first word.

Example:

Base link: http://kat.ph/usearch/{SEARCH FIELD GOES HERE}
String output from XML List : “Hello Sir”

Actual Output as link (without quotes): “http://kat.ph/usearch/Hello”
Expected output as link (without quotes): “http://kat.ph/usearch/Hello Sir”

Code is below

  <script type="text/javascript">
                if (window.XMLHttpRequest)
                {// code for IE7+, Firefox, Chrome, Opera, Safari
                    xmlhttp=new XMLHttpRequest();
                }
                else
                {// code for IE6, IE5
                    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.open("GET","playlist.xml",false);
                xmlhttp.send();
                xmlDoc=xmlhttp.responseXML; 

                document.write("<table border='1'>");
                var x=xmlDoc.getElementsByTagName("void");
                for (i=0;i<x.length;i++)
                { 
                    document.write("<tr><td>");
                    document.write(x[i].getElementsByTagName("string")[0].childNodes[0].nodeValue);
                    document.write("</td><td>");
                    //alert(x[i].getElementsByTagName("string")[0].childNodes[0].nodeValue); just testing to see what i get here
                    // document.write("<a href=http://www.kat.ph/usearch/" + x[i].getElementsByTagName("string")[0].childNodes[0].nodeValue + ">"+"KAT.PH"+"</a>");
                    document.write("<a href='" + "http://www.kat.ph/usearch/" + x[i].getElementsByTagName("string")[0].childNodes[0].nodeValue + "'>" + "KAT.PH" + "</a>"); 

                    document.write("</td></tr>");  

                }
                document.write("</table>");
            </script>
  • 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-02T19:25:16+00:00Added an answer on June 2, 2026 at 7:25 pm

    you cant have spaces in the URI (http://www.w3schools.com/jsref/jsref_encodeuri.asp). What you can do is encode it:

    var term = x[i].getElementsByTagName("string")[0].childNodes[0].nodeValue;
    var uri = "http://www.kat.ph/usearch/" + term;
    
    document.write("<a href='" + encodeURI(uri) + "'>" + "KAT.PH" + "</a>");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a dynamic bar in HTML using javascript. I have
I am trying to create an auto-refresh for a table using ajax/jquery, php/html, and
I am trying to create an html table by querying on an xml document.
I am trying to create a custom html button on my page using this
I am trying to create some dynamic html out of some data from db.
I'm trying to create a horizontal 100% stacked bar graph using HTML and CSS.
I'm currently trying dynamically create an html table in PHP. Further, I want the
I'm trying to create a editable textbox with HTML/CSS/Javascript that looks and functions like
I am trying to get some data from Magento trough php, it works but
I'm trying to parse an html output file from a program called mirdeep. I

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.