首页 > 代码库 > 不绑架输入--document.getElementById("linkage_"+id_type+"_echo").value=http://www.mamicode.com/"";--联动

不绑架输入--document.getElementById("linkage_"+id_type+"_echo").value=http://www.mamicode.com/"";--联动

 1 <script> 2     function w_linkage(id_type) 3     { 4         var selected = $("#linkage_"+id_type+"_triger").find("option:selected").text(); 5         switch (selected) 6         { 7             case ‘APA‘: 8                 document.getElementById("linkage_"+id_type+"_echo").readOnly=false; 9                 break;10             default :11             case ‘AMS‘:12                 document.getElementById("linkage_"+id_type+"_echo").value="";13                 document.getElementById("linkage_"+id_type+"_echo").readOnly=true;14                 break;15         }16     }17 </script>
                <tr>                    <td>位置分类: </td>                    <td    >                        <select class="form-control linkage_triger " name="page_position"  onclick="w_linkage(‘add‘)"  id="linkage_add_triger"  >                            <option value="http://www.mamicode.com/2" >APA</option>                            <option value="http://www.mamicode.com/1">AMS</option>                        </select>                    </td>                </tr>                <tr>                    <td>keyword:</td>                    <td><input type="text" name="keyword"></td>                </tr>                <tr>                    <td>brand:</td>                    <td><input type="text" name="brand"></td>                </tr>                <tr>                    <td>adasin:</td>                    <td><input type="text" name="adasin" placeholder="选AMS时,请跳过" id="linkage_add_echo"></td>                </tr>

 

 1         <tr> 2             <td>位置分类: </td> 3             <td> 4                 <select class="form-control" name="page_position_edit"  onclick="w_linkage(‘edit‘)"  id="linkage_edit_triger"  > 5                     <option value="http://www.mamicode.com/2" >APA</option> 6                     <option value="http://www.mamicode.com/1">AMS</option> 7                 </select> 8             </td> 9         </tr>10         <tr>11             <td>keyword:</td>12             <td><input type="text" name="keyword_edit" value="http://www.mamicode.com/<?= $_GET[‘keyword‘]?>"></td>13         </tr>14         <tr>15             <td>brand:</td>16             <td><input type="text" name="brand_edit" value="http://www.mamicode.com/<?= $_GET[‘brand‘]?>"></td>17         </tr>18         <tr>19             <td>adasin:</td>20             <td><input type="text" name="adasin_edit"  placeholder="选AMS时,请跳过"  value="http://www.mamicode.com/<?= $_GET[‘adasin‘]?>" id="linkage_edit_echo"></td>21         </tr>

//readyonly  交互,不绑架输入

// add edit  为同一脚本

 

问题:

1 document.getElementById("linkage_"+id_type+"_echo").innerHTML="";2 document.getElementById("linkage_"+id_type+"_echo").innerText="";3 $("#linkage_"+id_type+"_echo").emprt();;

为什么失效?

 

不绑架输入--document.getElementById("linkage_"+id_type+"_echo").value=http://www.mamicode.com/"";--联动