Results 1 to 5 of 5

Thread: JavaScript with HTML Parsing!

  1. #1
    Join Date
    Jan 2009
    Posts
    120

    JavaScript with HTML Parsing!

    Hello,

    I am quite new to JavaScript, though I have programmed in Java and ANSI C for years so the syntax is quite familiar to me. The only thing I do not understand is the precise limitations of JavaScript. I understand some of the limitations as my search continues on this daunting task I am trying to figure out. I have spent endless hours on google trying to find the solution to my question.

    Basically this is what I need done, I have an HTML form that is sent to a PHP file on a server. The server then sends back feedback (in HTML) and my web browser parses this HTML and views it. Is there a way for JavaScript to read ahead this data before the browser renders it and perhaps store it in a variable? If not, I can always have another window show the data and maybe have JavaScript read the html and store it in a variable. If either of these are possible, I would appreciate your input.

    Thank you

  2. #2
    Join Date
    Mar 2008
    Posts
    232

    Re: JavaScript with HTML Parsing!

    With The Parser, it can take HTML string and turn it into a DOM tree.When I got a nickel for every time a server side developer came to me and asked for a little piece of javascript that generates some kind of DOM structure.

    So here are some of the key features of Pure JavaScript HMTL Parser? Here it goes.
    HTMLtoDOM("<p>Hello <b>World" ,document.getElementById("test")) - this snippet parses input string, makes it valid XML, converts it to DOM and appends it to a specified page element. Sweet!

    HTMLtoXML("<img src=test.jpg>") - this one fixes the attribute declaration and adds missing closing ”/” at the end of a tag and produces <img src="test.jpg"/>. One of my personal pet peeves. Have been fighting with that for ages.

    HTMLtoXML("<p>Hello<p>World") - this one is pretty cool as well, it automatically adds missing tag closings and produces: <p>Hello</p><p>World</p>

  3. #3
    Join Date
    Mar 2008
    Posts
    227

    Re: JavaScript with HTML Parsing!

    By using AJAX it is possible to make javascript to communicate with serverside script.JavaScript property is probably the simplest method for parsing the response of an AJAX-based HTTP request returned from the web server as plain text.

  4. #4
    Join Date
    Jan 2009
    Posts
    120

    Re: JavaScript with HTML Parsing!

    Thanks for your prompt reply where could I start with the snippet of AJAX snippet,please provide me the information regarding the same.

  5. #5
    Join Date
    Oct 2008
    Posts
    167

    Re: JavaScript with HTML Parsing!

    Do you have a legitimate reason for wanting to do this?
    Why should it matter? Some people post weird link syntax so that it won't automatically get linked by the site thus having said site as a referer.

    In any case, I'm trying to make a Greasemonkey script that'll parse the text on any HTML page and make the appropriate changes.

Similar Threads

  1. Getting Html parsing error kb927917 in internet explorer 8
    By Girijaa in forum Technology & Internet
    Replies: 4
    Last Post: 14-02-2011, 10:41 AM
  2. Parsing XML with Adobe Javascript
    By shimani in forum Software Development
    Replies: 5
    Last Post: 30-06-2010, 05:37 PM
  3. How to use javascript to create HTML and CSS
    By KennedII in forum Software Development
    Replies: 5
    Last Post: 23-02-2010, 12:10 AM
  4. JavaScript for Dropdown HTML control
    By Dilbert in forum Software Development
    Replies: 4
    Last Post: 06-02-2010, 04:32 AM
  5. HTML/JavaScript/onclick
    By KADEEM in forum Software Development
    Replies: 4
    Last Post: 03-11-2009, 06:37 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,618,737.98383 seconds with 17 queries