当我选中复选框时,会显示文本框,否则它将处于隐藏状态。但价值并没有清除。帮我找人。提前致谢
HTML
<div class="munna">
<input id="chk_1" type="checkbox" value="1" onClick="document.getElementById('cutting_price').focus();chk_box(this.id);" onChange="chk_box(this.id)">Cutting
<div id="chk_1_box" style="display:none ;">
Price :<input type="text" value="" size="5" name="cutting_price" id="cutting_price" onChange="post_production()" />
</div>
</div>
<div class="munna">
<input id="chk_2" type="checkbox" value="1" onClick="document.getElementById('lamination_price').focus();chk_box(this.id);">Lamination
<div id="chk_2_box" style="display:none;">
Price :
<input type="text" size="5" value="" name="lamination_price" id="lamination_price" onChange="post_production()" />
</div>
</div>
<div class="munna">
<input id="chk_3" type="checkbox" value="1" onChange="chk_box(this.id);" onClick="document.getElementById('die_making_price').focus();chk_box(this.id);">Die Making
<div id="chk_3_box" style="display:none;">
Price :
<input type="text" size="5" value="" name="die_making_price" id="die_making_price" onChange="post_production()" />
</div>
</div>
JavaScript
function chk_box(chk)
{
if(document.getElementById(chk).checked)
{
var chk2 = chk+'_box';
document.getElementById(chk2).style.display='block';
}
else
{
var chk2 = chk+'_box';
document.getElementById(chk2).style.display='none';
document.getElementById(chk2).value='';
}
}