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

解决方案 »

  1.   

    meizz(梅花雪) 你解决了1可是没有解决2呀.
    2.如何过滤掉input type="checkbox"的标签?
      

  2.   

    如何过滤掉input type="checkbox"的标签?
      

  3.   

    <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(?!\s+type=\"checkbox\")[^>]+?value=(\"|\')([^>]*)\1[^>]+?>/gi;
        return(str.replace(re,"$2"));
    }
    </script>
      

  4.   

    大哥小弟愚笨.怎样才能只显示type="text"的内容呀.
    下面的我大概能明白.就是不等于checkbox的.我想要与成等于TEXT的怎么改?
    re=/<input(?!\s+type=\"checkbox\")[^>]+?value=(\"|\')([^>]*)\1[^>]+?>/gi;
      

  5.   

    <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" />
    <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!等待高手达人们的解答.
      

  6.   

    <textarea name=cnbruce>
    <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>
      

  7.   

    <textarea  name=cnbruce  cols=60  rows=6  >  
     <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=(\  "  &brvbar;\')([^  >]*)\1[^  >]+?  >/gi;  
           return(str.replace(re,  "$2  "));  
    }  
     </script  >  
    这样的话4和5也会被输出了.而我只想输出  INPUT  TYPE=  "TEXT  "  满足这个条件的value!等待高手达人们的解答. 
    name="checkbox" 和 type="checkbox" 对掉顺序后还是一样不好用.
      

  8.   

    感谢[btbtd(博学笃志, 切问近思; 神闲气静, 智深勇沉.-围炉夜话)]
      

  9.   

    这个处理得更好<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>
      

  10.   

    刚刚试了一下谢谢你.你写的太好了.输出后是"2,3"!
    可是我只想在把原来input值=2的哪地方输出2,input值=3的哪地方输出3就可以了.
      

  11.   

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