acerbic coffee
走自己的路,让别人跑步
posts - 26,comments - 14,trackbacks - 0

<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>
这里先感谢[btbtd(博学笃志, 切问近思; 神闲气静, 智深勇沉.-围炉夜话)]
同时也希望大家帮忙.
刚刚试了一下谢谢你.你写的太好了.输出后是"2,3"!
可是我只想在把原来input值=2的哪地方输出2,input值=3的哪地方输出3就可以了.
我不想要数组.只想让他正常输出.




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

posted on 2006-10-25 15:08 acerbic coffee 阅读(314) 评论(0)  编辑  收藏 所属分类: 个人记录

只有注册用户登录后才能发表评论。


网站导航: