<textarea name=cnbruce cols=60 rows=6>
<input type="checkbox" name="checkbox" value="1" />
<input type="text" name="text" value="2" />
<input name="text" type="text" value="3" />
</textarea><button onclick=alert(pla(cnbruce.value))>alert</button><script>
function pla(str)
{
var re=/<input[^>]+?value=(\"|\')([^>]*)\1[^>]+?>/gi;
return(str.replace(re,"$2"));
}
</script>
<input type="checkbox" name="checkbox" value="1" />
<input type="text" name="text" value="2" />
<input name="text" type="text" value="3" />
</textarea><button onclick=alert(pla(cnbruce.value))>alert</button><script>
function pla(str)
{
var re=/<input[^>]+?value=(\"|\')([^>]*)\1[^>]+?>/gi;
return(str.replace(re,"$2"));
}
</script>
解决方案 »
- JS一次点击控制2个按钮。
- 在JS类中这样定义的变量怎么变成了静态变量?一直累加。我知道用this就可以,但我想知道为什么。
- ActiveXObject
- 给分,绝不含糊,http中content-type头的值问题,word文档对应的是"application/msword",那么PPT文档对应的是什么?
- 求一个JS获取客户端网卡IP的函数!
- 急、、、简单问题:链接提示?
- 如何判断同页面所有文本框的内容是否相同?
- 选择文件夹的输入框怎么写呀?(就像选择文件的输入那种形式的)
- 类似网站统计器东西,求思路。。。。。
- 使用Three.js实例无法浏览谷歌浏览器已经设置内容显示
- 在下拉菜单中添加新option的问题
- 如何实现定时在javascript里载入另一段代码并运行之
2.如何过滤掉input type="checkbox"的标签?
<input type="checkbox" name="checkbox" value="1" />
<input type="text" name="text" value="2" />
<input name="text" type="text" value="3" />
</textarea><button onclick=alert(pla(cnbruce.value))>alert</button><script>
function pla(str)
{
var re=/<input(?!\s+type=\"checkbox\")[^>]+?value=(\"|\')([^>]*)\1[^>]+?>/gi;
return(str.replace(re,"$2"));
}
</script>
下面的我大概能明白.就是不等于checkbox的.我想要与成等于TEXT的怎么改?
re=/<input(?!\s+type=\"checkbox\")[^>]+?value=(\"|\')([^>]*)\1[^>]+?>/gi;
<input type="checkbox" name="checkbox" value="1" />
<input type="text" name="text" value="2" />
<input name="text" type="text" value="3" />
<input type="radio" name="text" value="4" />
<input name="text" type="hidden" value="5" />
</textarea><button onclick=alert(pla(cnbruce.value))>alert</button><script>
function pla(str)
{
var re=/<input(?!\s+type=\"checkbox\")[^>]+?value=(\"|\')([^>]*)\1[^>]+?>/gi;
return(str.replace(re,"$2"));
}
</script>
这样的话4和5也会被输出了.而我只想输出 INPUT TYPE="TEXT" 满足这个条件的value!等待高手达人们的解答.
<input type="checkbox" name="checkbox" value="1" />
<input type="text" name="text" value="2" />
<input name="text" type="text" value="3" />
</textarea><button onclick=alert(pla(cnbruce.value))>alert</button><script>
function pla(str){
re=/(<input[\s\S]*?type\="text"[\s\S]*?value\=")(.*?)(")/gi;
return(str.replace(re,"$1已找到$3"));
}
</script>
<input type= "checkbox " name= "checkbox " value= "1 " / >
<input name="checkbox" type="checkbox" value="1" />
<input type= "text " name= "text " value= "2 " / >
<input name= "text " type= "text " value= "3 " / >
<input type= "radio " name= "text " value= "4 " / >
<input name= "text " type= "hidden " value= "5 " / >
</textarea > <button onclick=alert(pla(cnbruce.value)) >alert </button >
<script >
function pla(str)
{
var re=/ <input(?!\s+type=\ "checkbox\ ")[^ >]+?value=(\ " ¦\')([^ >]*)\1[^ >]+? >/gi;
return(str.replace(re, "$2 "));
}
</script >
这样的话4和5也会被输出了.而我只想输出 INPUT TYPE= "TEXT " 满足这个条件的value!等待高手达人们的解答.
name="checkbox" 和 type="checkbox" 对掉顺序后还是一样不好用.
<input type="checkbox" name="checkbox" value="1" />
<input type="text" name="text" value="2" />
<input name="text" type="text" value="3" />
<input type="radio" name="text" value="4" />
<input name="text" type="hidden" value="5" />
</textarea><button onclick=alert(pla(cnbruce.value))>alert</button><script>
function pla(str){
re=/<input[^\>]*?type\="text"[\s\S]*?value\="(.*?)"/gi;
str=str.match(re).join();
re=/<input[^\<]*?value\="(.*?)"/gi;
return(str.replace(re, '$1'));
}
</script>
可是我只想在把原来input值=2的哪地方输出2,input值=3的哪地方输出3就可以了.
<input type="checkbox" name="checkbox" value="1" />
<input type="text" name="text" value="2" />
<input name="text" type="text" value="3" />
<input type="radio" name="text" value="4" />
<input name="text" type="hidden" value="5" />
</textarea><button onclick=alert(pla(cnbruce.value))>alert</button><script>
function pla(str){
re=/<input[^\>]*?type\="text"[\s\S]*?value\="(.*?)"/gi;
str=str.match(re).join();
re=/<input[^\<]*?value\="(.*?)"/gi;
return(str.replace(re, '$1').match(/[^\,]+/ig).join(''));
}
</script>