标签:hose close onclick orm form 选中 index cti bsp
method1:
<form name="f1">
<label id="lbl2">xxx</label>
<select id="pro1">
<option selected>添加项目</option>
<option onClick="pro1()">1</option>
<option onClick="pro1()">2</option>
<option onClick="pro1()">3</option>
</select>
</form>
<script>
function pro1(){
var pro1=document.getElementById("pro1");
var lbl2=document.getElementById("lbl2");
var val=pro1.selectedIndex;
lbl2.innerHTML=pro1[val].value;
}
</script>
method2:
<form name="frm">
<input type=checkbox name=item value=1 onclick="choseItem();">
a
<input type=checkbox name=item value=2 onclick="choseItem();">
b
<input type=checkbox name=item value=3 onclick="choseItem();">
c
<input type=checkbox name=item value=4 onclick="choseItem();">
d
<input type=text name="txt" id="txt">
</form>
<input type=button value="关闭" onclick="foo();">
<script>
function choseItem()
{
var v="";
var check_item = document.frm.item;
for(i=0;i<check_item.length;i++)
{
if(check_item[i].checked)
{
v+=","+check_item[i].value;
}
document.frm.txt.value=v.replace(/^,{1}/,"");
}
}
function foo()
{
window .close();
window .opener.document.getElementById("txt0").value=document.getElementById("txt").value
}
</script>
标签:hose close onclick orm form 选中 index cti bsp
原文地址:http://www.cnblogs.com/moziyan/p/6394817.html