您现在的位置是:首页 > 电脑技术查询 > web开发

正则取值name="xxxx"解决办法

编辑:chaxungu时间:2022-10-02 23:23:25分类:web开发

正则取值name="xxxx"
使用正则取出 <input type= "text " name= "xxxx "/>

中name的value


------解决方案--------------------
<script type= "text/javascript ">
var name_p =/ <input[\S\s]+?name=\ "([^\ "]+)\ "[^> ]+> /i;
var name = ' <input type= "text " name= "xxxx "/> '.match(name_p)[1];
alert(name);
</script>