Question : Javascript to update values in <div>

Javascript code to change the value in the following <div> with any passed in value:
<div id="status">INACTIVE</div>

Answer : Javascript to update values in <div>

Hi ,
Try These  Example:
<html>
<head>
<script language="javascript" type="text/javascript">
 // It USed to add new inner content your Existing div "DivEx"
 function show_prompt()
 {
   var str=prompt("Please enter Div input Text:");
         if (str!=null && str!="" && str !='undefined' )
        {
             var divobj=document.getElementById("DivEx");
                    divobj.innerHTML=str;      
        }
 }
 // It Used to add new div in your Existing Div "DivEx" , It s Addtional examples

function addElement() {
  var ni = document.getElementById('DivEx');
  var numi = document.getElementById('theValue');
  var num = (document.getElementById('theValue').value -1)+ 2;
  numi.value = num;
  var newdiv = document.createElement('div');
  var divIdName = 'my'+num+'Div';
  newdiv.setAttribute('id',divIdName);
  newdiv.innerHTML = 'I am Your New Div:' + divIdName;
  ni.appendChild(newdiv);
}

</script>
</head>
<body>
<input type="button" onclick="show_prompt()" value="Enter Input Box" />
<input type="button" onclick="addElement()" value="CreateInnerDiv" />
<input type="hidden" value="0" id="theValue" />
<div id="DivEx">INACTIVE</div>
</body>
</html>
Random Solutions  
 
programming4us programming4us