Convert your HTML into JS

Useful for those greasemonkey scripts or when you just wanna inject some javascript into the page after the fact. I've actually used HTML2JS to create the IFrame on this page view the source to check it out.

Paste your HTML below

How it works

With a little bit of a custom create javascript function serverside processing and some help from simple_html_dom converting is easy. The javascript is supplied with a unique namespace so not to clash with other things on the page and to give a handle on the objects in page such as the root node. You can use the formatted output for adding to the H2JS object or manipilating the object thereafter. The output can also be accessed via post or get from anywhere on the web not just here. Head over to the resources page to read more. This script adds listenters to tags which are invoked from inline sources such as
<a href="javascript:void(0);" onclick="alert('ok');return false;">Link</a>
However it does not add them in the addEventListener/attachEvent fashion it adds them directly via

  object.onclick = function() { 
    return false;

The appended HTML output also shows the text inline. The link below illustrates the example above.


  • Using a `#` in the HTML while passing via GET href throws an error.