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
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>
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.
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.
Re: JavaScript with HTML Parsing!
Quote:
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.