Well I'm trying to make a script for my website that show a text when player choose an option on a select tag.
Here is what I did but cant get it working >.<
Here is my javascript function..
Here is what I did but cant get it working >.<
PHP:
<?php
echo '<table>
<tr>
<td> <center><b>Select your region:</b></center> </td>
<td> <select name="reg" id="reg" onChange="alter();">
<option value="">-----------</option>
<option value="EU">EUROPE</option>
<option value="CH">CHINA</option>
</select>
</td>
</tr>
</table>
<br />
<div id="CH" style="display:none">hi china</div><br />
<div id="EU" style="display:none">hi europe</div>';
?>
Here is my javascript function..
Code:
function alter() {
if(document.getElementById('reg').value == "CH") {document.getElementById('CH').display = ""; document.getElementById('EU').display = "none";};
if(document.getElementById('reg').value == "EU") {document.getElementById('EU').display = ""; document.getElementById('CH').display = "none";};
}