Hi,
I have a Select list and would like to print the text between then
<option>text1</option>
<option>text2</option>
<option>text3</option>
on the screen when I click on the text in the select list. How can I do it?
//Thanks
![]() | It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!) |

|
|
|
|
<script type="text/javascript">
window.onload=function(){
document.getElementById('opt').onchange=function(){
document.getElementById('show').innerHTML+=this.options[this.selectedIndex].text+'<br>';}}
</script>
<select id="opt">
<option>text1</option>
<option>text2</option>
<option>text3</option>
</select>
<p id="show"></p>

rangana wrote:Here's a basic examle for you to keep going:
- Code: Select all
<script type="text/javascript">
window.onload=function(){
document.getElementById('opt').onchange=function(){
document.getElementById('show').innerHTML+=this.options[this.selectedIndex].text+'<br>';}}
</script>
<select id="opt">
<option>text1</option>
<option>text2</option>
<option>text3</option>
</select>
<p id="show"></p>
Hope it helps
Users browsing this forum: No registered users and 1 guest