簡體   English   中英

如何在下拉菜單中設置值

[英]How to set value in drop down menu

我有那個代碼:

 </script>
<!-- End HTML Area -->
</div>
</td>
</tr>
<tr>
<td height='47' colspan='4'></td>
<td colspan='13'  valign='top' align='right'>
<table cellpadding='0' cellspacing='0' cols='1'  class='PSGROUPBOXWBO'  width='934'>
<tr><td class='PSGROUPBOXLABEL'  align='right'><a name='DERIVED_RC_IRSL_MT_TRIPLE_GB' id='DERIVED_RC_IRSL_MT_TRIPLE_GB' tabindex='-1' href="javascript:submitAction_win6(document.win6,'DERIVED_RC_IRSL_MT_TRIPLE_GB');"><img src='/cs/crmprod/cache/PT_COLLAPSE_HEB_1.gif' alt='הסתרת הנתונים' title='הסתרת הנתונים' border='0' /></a>&nbsp;סיווג פניה לאחר טיפול בלקוח&nbsp;</td></tr>
<tr><td width='932'>
<table  id='ACE_width' border='0' cellpadding='0' cellspacing='0' cols='10' width='932' class='PSGROUPBOX' style='border-style:none' >
<tr>
<td width='0' height='4'></td>
<td width='70'></td>
<td width='3'></td>
<td width='246'></td>
<td width='41'></td>
<td width='3'></td>
<td width='247'></td>
<td width='49'></td>
<td width='3'></td>
<td width='270'></td>
</tr>
<tr>
<td height='4' colspan='3'></td>
<td rowspan='2'  valign='top' align='right'>
<select name='MT_CASE_EXTRA_MT_CAT_SEQ_NUM' id='MT_CASE_EXTRA_MT_CAT_SEQ_NUM' tabindex='360' size='1'  class='PSDROPDOWNLIST' style="width:207px; " onchange="if (document.readyState == 'complete') submitAction_win6(this.form,this.name);" >
<option value="0" selected='selected'></option>
<option value="21">test</option>
<option value="23">test2</option>
<option value="64">test3</option>
<option value="41">test4</option>
<option value="61">test5</option>
<option value="141">test6</option>
<option value="22">test7</option>
<option value="63">test8</option>
<option value="24">test9</option>
</select>

我嘗試制作JavaScript代碼。 當用戶將其粘貼+粘貼到瀏覽器中的地址字段時,將在菜單中自動選擇我想要的值。

這是我做的:

javascript:function GetSelectedItem() {     
    var e = document.getElementById("selected24");
    var strSel = "The Value is: " + e.options[e.selectedIndex].value + " and text is: " + e.options[e.selectedIndex].text;
    alert(strSel);
    } 

相關問題: 如何使用javascript以編程方式設置選擇框元素的值?

如果要設置<select>元素的選定值,則應該這樣做:

var newValue = 24; // or whatever
document.getElementById('MT_CASE_EXTRA_MT_CAT_SEQ_NUM').value = newValue;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM