<textarea name=cnbruce>
<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>
<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>
20156161 [email protected]
<textarea name=cnbruce>
<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>PS: 俺很少用 IM. 加与不加一个样, MSN: [email protected]
能不能不用str=str.match(re).join('');
如果在一个网页中,那么别的内容也同样被过滤掉了.
<table>
<tr>
<td><input type="checkbox" name="checkbox" value="1" /></td>
<td><input type="text" name="text" value="2" /></td>
<td><input type="text" value="3" name="text" /></td>
<td><input type="radio" name="text" value="4" /></td>
<td><input name="text" type="hidden" value="5" /></td>
</tr>
</table>
</textarea><button onclick=alert(pla(cnbruce.value))>alert</button><script>
function pla(str){
re=/<input[^\>]*?type\="text"[\s\S]*?value\="(.*?)"/gi;
return(str.replace(re, '$1'));
}
</script>
我试着按你写的做了个页.为什么数后面的内容都不能删除呢?