Header Ads

Example :- How to Create Auto Code Generator Using Javascript Part:-1



H
ow to create javascript auto code generator. i'm always use javascript generator in my blog for giving blogger widgets, and it's really nice method, and many of my readers ask me how to create javascript auto code generator, so in this post i'll give you some example codes for it, if your question is how to create javascript generator then i'm sure you are true beginnersJavascript language is hard for understand but not impossible to read/understand, you need to just study the code carefully, so let's start learn the coding..... :)

let's trying to create a simple form where people input in some values and on submit auto generates the code below the form. Which then they can copy to use.

Javascript

<SCRIPT TYPE="text/javascript">
document.getElementById("go").onclick = function() {
document.getElementById("code").innerHTML = "<div style='width:" + document.getElementById("width").value+ "; height:" + document.getElementById("height").value + ";'>" + document.getElementById("content").value + "</div>";};
</SCRIPT>

HTML

Width: <input id="width" type="text" /> <br/><br/>
Height: <input id="height" type="text" /> <br/><br/>
Content: <input id="content" type="text" /><br/><br/>
<button id="go">Go</button><br/><br/>
<textarea id="code" cols="30" rows="10" ></textarea>

as seen here: http://jsfiddle.net/69q57/13/

It's part:- 1 of example, in the next post i'll come with part:-2 ,

Was this post useful to you? then please drop your comments below...

No comments

Powered by Blogger.