PDA

View Full Version : this question



d-machine
08-24-2009, 04:27 PM
Hi,
I've wrote this:
Html:


<select>
<option value="black" onclick="updatec()">Black</option>
</select>

JS:


function updatec() {
alert(this.getPropertyValue());
}

What's wrong in what I've written?
I want it to open a pop up that says black, like the value of this option.

thenajsays
08-24-2009, 05:44 PM
try "this.value"

boogyman
08-24-2009, 05:54 PM
Please tell me you aren't going to do that to every option. If so, please review the code below



<select name="color" id="color">
<option value="">TEXT</option>
<option value="">TEXT</option>
<option value="">TEXT</option>
<option value="">TEXT</option>
</select>




document.getElementById('color').onchange = function() {alert(this.value)}