Search This Blog

Selected value/ selected index from dropbox javascript

Posted by Team on
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

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"


<select name="select" id="select" onchange="haha();">
<option value="1">a1</option>
<option value="2">a2</option>
<option value="3">a3</option>
<option value="4">a4</option>