0

在此处输入图像描述

我有名为模块、优先级、请求日期等的数据行,这些数据行是在我的网站上动态获取的。当从我的下拉列表中选择计算机请求的值时,有没有办法可以在名为“成本中心”的模块下添加一行?这是下拉列表的代码。

    <span id="dg_form_ctl02_lbl_show_tag" style="display:inline-block;background-    color:Transparent;border-color:Navy;border-width:3px;border-style:Double;font-    family:Arial;font-size:12px;width:130px;">Module*</span> 
                                                </td><td>








                                                    <select name="dg_form$ctl02$DropDownList1" onchange="javascript:setTimeout('__doPostBack(\'dg_form$ctl02$DropDownList1\',\'\')', 0)" id="dg_form_ctl02_DropDownList1">
        <option value="">--select one--</option>
        <option value="Cellular Phone">Cellular Phone Request</option>
        <option selected="selected" value="Computer">Computer Request (Up to VP Approval)</option>
        <option value="Account Creation">Create Network/SAP Account</option>
        <option value="Account Delete">Delete Network/SAP Account</option>
        <option value="FIS">FIS</option>
        <option value="FP">FP</option>
        <option value="General">General Support</option>
        <option value="Report">Reports</option>
        <option value="SAP">SAP</option>
        <option value="Web Application">Web Application</option>

    </select>





                                                </td>
</tr><tr style="background-color:White;">
    <td valign="top">

这是我到目前为止的警报代码

function alertMe() {
var n = document.getElementById("dg_form_ctl02_DropDownList1").value;
if (n == "Computer") {
alert ('Changed');
4

1 回答 1

0

我认为这会奏效

selectObject.add(option,before)


function GetSelectedValue(selectItem)
{
var index = document.getElementById(selectItem).selectedIndex;

alert("value =" + document.getElementById(selectItem).value);
alert("text =" + document.getElementById(selectItem).options[index].text);
}



<select id="mySelect">
<option>Apple</option>
<option>Pear</option>
<option>Banana</option>
<option>Orange</option>

于 2012-08-13T17:44:26.243 回答