Facebook Twitter Reset

This Tutorial Has Been Viewed 1,732 Times.

DOM elements dynamically using our JAVASCRIPT


DOM elements
Dynamically using our JAVASCRIPT
JAVASCRIPT

function AddItem()
{
// Create an Option object

var opt = document.createElement(‘option’);

// Add an Option object to Drop Down/List Box
document.getElementById(“DropDownList”).options.add(opt);
var Text =prompt(“Enter Your Name”);

var Value =’addingsongs.php’
var Name = ‘data’;

// Assign text and value to Option object
opt.text = Text;
opt.setAttribute(‘name’, Name);
opt.value = Value;

}

HTML CODE

<select id=”DropDownList” name=”selectbox” >

</select>

<input type=”button” onClick=”AddItem()” value=”tutorialz.tk” />


The above code actually means that there is a select box and a button in our HTML page.When we click our button the fuction Additem()is called and a prompt box appears, give the name as you wish and that name is dynamically added to our select box simple……ANY QUERIES MAIL ME

VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: -1 (from 1 vote)

Incoming search terms:




You will also be interested in ,

No comments yet.

Leave a Comment

Spam protection by WP Captcha-Free

Affordable Seo PackagesSeo BlogEdu Backlinks
More in Apache, PHP (121 of 138 articles)