Posts

Showing posts with the label select drop down javascript

Selected value/ selected index from dropbox javascript

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script> function haha() { //var e = document.getElementById("select"); var strUser = document.getElementById("select").options[document.getElementById("select").selectedIndex].text; // If you would like to select value then use "value" in place of  "text" alert(strUser); } </script> </head> <body> <select name="select" id="select" onchange="haha();"> <option value="1">a1</option> <option value="2">a2</option> <option value="3">a3</option...

select option in dropbox through javascript

If you want to select an option in your Dropdown box as you select that option from a link. Here is solution...... I have used the code with onclick event you r free to use at any event. Put this into Head section: <script> function setdate(num) { //alert(num); document.f1.approxdate[num].selected=true; } </script> Put this into Body section: <form name="f1" id="f1" > <select name="selSS1" id="approxdate"> <option value="0">ha ha ha</option> <option value="1">hi hi hi</option> <option value="2">hu hu hu</option> <option value="3">he he he</option> <option value="4">ho ho ho</option> </select> <br /><br /> <a href="javascript:void(0);" onclick="javascript:setdate(0)">ha ha ha</a> <br /> <a href="javascript:vo...