日期:2014-05-16  浏览次数:20477 次

根据下拉列表的值改变输入框的属性??
<form   id= "form1 "   name= "form1 "   method= "post "   action= " ">
    <select   name= "select ">
        <option   value= "l_title "> 标题 </option>
        <option   value= "l_date "> 留言时间 </option>
    </select>
    <input   name= "keyword "   type= "text "   id= "keyword "   />
    <input   type= "submit "   name= "Submit "   value= "提交 "   />
</form>

当select   的值改为l_date       点击keyword   才执行onchick= "ShowCalendar(this.id) "

可能我说得不太清楚,希望各们大虾能看懂

------解决方案--------------------
<script type= "text/javascript ">
function changeSelect(athis){
if(athis.value== 'l_data ') {
document.getElementById( 'keyword ').onclick = function() {
ShowCalendar(this.id);
}
} else {
document.getElementById( 'keyword ').onclick = function() {

}
}
}
</script>

<form id= "form1 " name= "form1 " method= "post " action= " ">
<select name= "select " id= "select " onchange= "changeSelect(this) ">
<option value= "l_title "> 标题 </option>
<option value= "l_date "> 留言时间 </option>
</select>
<input name= "keyword " type= "text " id= "keyword " />
<input type= "submit " name= "Submit " value= "提交 " />
</form>