Jump to content
php.lv forumi

laikam js vai ajax


nikidijs

Recommended Posts

Cik noprotu tad man vajadzīgo lietu var panākt ar js vai ajax, bet tikai tāds sīkums kā, tas ka es šajos abos esmu pilnīgs nulle.

 

Tātad situācija/problēma sekojoša:

 

Ir <select> un <option values> un vajadzētu lai "onchange" noteiktā vietā pārādās mans izvēlētais "option".

 

Piem.

<td>
//šeit atrodas tas selekts
</td>
<td>
//"onchange" šeit vajadzētu lai parādās mans izvēlētais options
</td>

 

Nu apmēram tā :/

Thanks jau iepriekš :)

Link to comment
Share on other sites

Kaut kā tā:

<select id="mans_select">
<option>sarkans</option>
<option>dzeltens</option>
<option>zils</option>
<option>melns</option>
</select>

<div id="liekam_te"></div>

<script type="text/javascript">
var myselect=document.getElementById("mans_select")
myselect.onchange=function(){
 	var chosenoption=this.options[this.selectedIndex].text;
  	document.getElementById("liekam_te").innerHTML = chosenoption;
}
</script>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...