Helpful JavaScript for Web development

JavaScript OOP with Input Display Toggle

Usage of this JavaScript code effect is just toggle (show/display) the input text fields when the users click the specified input checkboxes. But this JavaScript code example made with OOP skills, it'... detail at - 2.000+ free JavaScript codes

How to setup

Step 1: Use JavaScript code below to setup the script
<script type="text/javascript">
// Created by: Fang |
// This script downloaded from

function addElement() {
var aInput=document.getElementById('myspan').getElementsByTagName('input');
for(var i=0; i<aInput.length; i++) {
    aInput[i].onclick=new Function('addDelete(this)');

function addDelete(obj) {
var parentSpan=document.getElementById('myspan');
if(obj.nextSibling.nodeName!='INPUT') { // add
    var oInputText=document.createElement('input');
    oInputText.setAttribute('type', 'text');
    parentSpan.insertBefore(oInputText, obj.nextSibling);
else { // delete

// Multiple onload function created by: Simon Willison
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {

addLoadEvent(function() {
Step 2: Copy & Paste HTML code below in your BODY section
<span id="myspan">
  <input type="checkbox">

  <input type="checkbox">
  <input type="checkbox">

JavaScript Bookmark Page script - JavaScript Color Wheel - JavaScript Image slideshow
Quote Originally Posted by Copyright
The Site may provide, or third parties may provide, links to Internet World Wide Web sites or resources. Because has no control over such sites and resources, you acknowledge and agree that is not responsible for the availability of such external sites or resources, and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. You further acknowledge and agree that shall not be responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods or services available on or through any such site or resource.