WordPress.org

Ready to get started?Download WordPress

Forums

page HTML (2 posts)

  1. mrhussein
    Member
    Posted 1 year ago #

    hi :)

    i have created new page in WP and chose HTML and enter the following code:

    <html>
    <head>
    <script type="text/javascript">
    function showUser(str)
    {
    if (str=="")
      {
      document.getElementById("txtHint").innerHTML="";
      return;
      }
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
        }
      }
    xmlhttp.open("GET","http://localhost:14296/getuser.php?q="+str,true);
    xmlhttp.send();
    
    }
    </script>
    </head>
    <body>
    
    <form>
    <select name="users" onchange="showUser(this.value)">
    <option value="">Select a person:</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    </select>
    </form>
    <br />
    <div id="txtHint"><b>Person info will be listed here.</b></div>
    
    </body>
    </html>

    but im getting error in displaying the pge in the status bar (Done, with errors)

    so could you help me how to solve this

    thanks :)

  2. Putting raw HTML into the WordPress post editor is always a tricky thing to do and that snippet with the <html><head> ... </html> just will not work. Also referencing something via localhost will break if you don't actually have that on your PC or Mac.

    If you want to insert something like that into a page then give these links a read.

    http://codex.wordpress.org/Pages#Page_Templates

    http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates

    When you are ready to create your page then you can apply that new template to the page.

Topic Closed

This topic has been closed to new replies.

About this Topic