Add HTML Control with JavaScript
March 19th, 2010 — adminThis chapter explains how to display add HTML control dynamically through JavaScript.
Click for Demo : Add HTML Control
Download the script : Add HTML Control
This chapter explains how to display add HTML control dynamically through JavaScript.
Click for Demo : Add HTML Control
Download the script : Add HTML Control
In this program just change the source of iframe and your loading.gif will show upto that time when page will not upload finally.
For Demo Click Here
Download Script Click Here
Save this code as external JavaScript file named: agree.js
var agree=0;
// 0 = ‘no’, 1 = ‘yes’
function agree2() {
if (!document.getElementById) return false;
agree=1;
document.getElementById(‘box’).style.background=’#fff000′;
if (agree) {
document.getElementById(‘enterName’).style.visibility = ‘visible’;
}
document.enableform.box.focus();
}
function disagree() {
if (!document.getElementById) return false;
agree=0;
if (!agree) {
document.getElementById(‘enterName’).style.visibility = ‘hidden’;
}
document.enableform.done.focus();
}
function goSubmit() {
if (agree==0) {
alert(“DISGREE: You can insert the next step here”);
} else if (agree==1 && document.enableform.box.value==”) {
alert(“You must enter your name!”);
document.enableform.box.focus();
} else {
alert(“AGREE: You can insert the next step here”);
}
}
Save this code in the <style> section within the HEAD section of HTML document.
#enterName {
visibility: hidden;
padding-left: 50px;
}
Save this code into the HEAD section of HTML document
<script type=”text/javascript” src=”agree.js”></script>
Save this code into the BODY section of HTML document
<form name=”enableform”>
<input type=”radio” name=”enable” value=”agree” onclick=”agree2();”>I agree
<div id=”enterName”>Please enter your name to show agreement: <input type=text id=”box” name=”box”></div>
<input type=”radio” name=”enable” value=”disagree” onclick=”disagree();”>I disagree
<br><br>
<input type=”button” value=”Done!” name=”done” onclick=”goSubmit()”>
</form>
<HTML><HEAD><TITLE>ABC</TITLE>
<SCRIPT LANGUAGE=”JAVASCRIPT” TYPE=”TEXT/JAVASCRIPT”>
<!–
a = 23;
function ad()
{
a = (++a);
alert(a);
}
//–>
</script>
</HEAD>
<BODY>
<a href=”javascript:ad();” mce_href=”javascript:ad();” title=”Add more” name=”add”>
Add More Records
</a>
</BODY></HTML>