<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>

解决方案 »

  1.   

    -__- 郁闷.btbtd能加我QQ或MSN吗?
    20156161 [email protected]
      

  2.   

    这样更好, 要不然就浪费了一个 match
    <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]
      

  3.   

    你用这句是能达到效果.可是别的也没了.
    能不能不用str=str.match(re).join('');
    如果在一个网页中,那么别的内容也同样被过滤掉了.
      

  4.   

    <textarea name=cnbruce>
    <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>
    我试着按你写的做了个页.为什么数后面的内容都不能删除呢?