如何把选择的元素(input,textarea)的ID放在一个Input里? INPUT里面可以用spilt(",")来做个数组操作查找。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <form method="post" action=""><input type="text" name="a" id="a"><input type="text" name="b" id="b"><input type="text" name="c" id="c"><input type="checkbox" name="d" id="d"><input type="checkbox" name="e" id="e"><input type="radio" name="f" id="f"><input type="radio" name="g" id="g"><input type="button" name="h" id="h" value="button"><input type="submit" name="i" id="i" value="submit"><textarea name="j" id="j" rows="4" cols="50"></textarea><input type="text" name="col"></form><script language="javascript"><!--window.onload = function(){ var f = document.forms[0]; for(i=0;i<f.length;i++) { if( f.elements[i].type != "hidden" && f.elements[i].name != "col" ) { f.elements[i].onclick=function () { if ( f.col.value == "" ) { var col = []; col.push( this.id ); this.style.backgroundColor = "#F00"; } else { var col = f.col.value.split(","); if( col.exsit( this.id ) ) { this.style.backgroundColor = "#FFF"; col.remove( this.id ); } else { col.push( this.id ); this.style.backgroundColor = "#F00"; } } f.col.value = col.join(","); } } }}Array.prototype.exsit = function(v){ for(i=0;i<this.length;i++) { if(this[i] == v) return true; } return false;}Array.prototype.remove = function(v){ for(i=0;i<this.length;i++) { if(this[i] == v) return this.splice(i,1); }}//--></script> 非常感谢,呵呵Thanks very very very much。我知道怎么做法,就是不会写,语法不熟悉。惭愧 JQ在火狐下怎么阻止按钮提交事件啊?IE正常,急。。。。!!! 帮忙看看为什么打印出来的是 undefined ExtJs IE 慢 问题,高手请进! overflow FF 兼容问题 新手extjs4.0 问题 这个有没有办法实现?把select替换为input 请问下面代码怎么在NETSCAPE 7中有效??(在IE中显示正常!) 如何使弹出的窗口获得焦点 如何自制一个js文档生成器满足公司的特定需求? 麻烦把这个PHP文件转换成JS。 这个问题需要用到javascript,请帮助! 紧急求教远程子窗口如何向本地父窗口传值
<input type="text" name="a" id="a">
<input type="text" name="b" id="b">
<input type="text" name="c" id="c">
<input type="checkbox" name="d" id="d">
<input type="checkbox" name="e" id="e">
<input type="radio" name="f" id="f">
<input type="radio" name="g" id="g">
<input type="button" name="h" id="h" value="button">
<input type="submit" name="i" id="i" value="submit">
<textarea name="j" id="j" rows="4" cols="50"></textarea>
<input type="text" name="col">
</form><script language="javascript">
<!--
window.onload = function()
{
var f = document.forms[0];
for(i=0;i<f.length;i++)
{
if( f.elements[i].type != "hidden" && f.elements[i].name != "col" )
{
f.elements[i].onclick=function ()
{
if ( f.col.value == "" )
{
var col = [];
col.push( this.id );
this.style.backgroundColor = "#F00";
}
else
{
var col = f.col.value.split(",");
if( col.exsit( this.id ) )
{
this.style.backgroundColor = "#FFF";
col.remove( this.id );
}
else
{
col.push( this.id );
this.style.backgroundColor = "#F00";
}
}
f.col.value = col.join(",");
}
}
}
}
Array.prototype.exsit = function(v)
{
for(i=0;i<this.length;i++)
{
if(this[i] == v)
return true;
}
return false;
}
Array.prototype.remove = function(v)
{
for(i=0;i<this.length;i++)
{
if(this[i] == v)
return this.splice(i,1);
}
}
//-->
</script>
我知道怎么做法,就是不会写,语法不熟悉。惭愧