Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Javascript从外部网页提取特定的输入字段值_Javascript_Jquery - Fatal编程技术网

如何使用Javascript从外部网页提取特定的输入字段值

如何使用Javascript从外部网页提取特定的输入字段值,javascript,jquery,Javascript,Jquery,我使用ajax从外部网站获取网页内容,但现在我需要一个函数来提取已经自动填充的特定输入字段值 网页内容如下: ......... <input name="fullname" id="fullname" size="20" value="David Smith" type="text"> <input name="age" id="age" size="2" value="32" type="text"> <input name="income" id="incom

我使用ajax从外部网站获取网页内容,但现在我需要一个函数来提取已经自动填充的特定输入字段值

网页内容如下:

.........
<input name="fullname" id="fullname" size="20" value="David Smith" type="text">
<input name="age" id="age" size="2" value="32" type="text">
<input name="income" id="income" size="20" value="22000$" type="text">
.........
。。。。。。。。。
.........
我只想获得
fullname
的值,可能需要一些javascript正则表达式或jquerydom解析器,我知道我可以用php轻松实现,但我希望使用javascript或jQuery

注意:这些输入不在我的页面中,它们只是通过Ajax从其他网站获取的


谢谢

使用jQuery
find
方法,比如
$(response).find('#fullname').val()
。请参阅此处的文档

使用jQuery
find
方法,如
$(response).find(“#全名”).val()
。请参阅此处的文档

jQuery以了解救援:

var body = '<div><input name="fullname" id="fullname" size="20" value="David Smith" type="text"><input name="age" id="age" size="2" value="32" type="text"><input name="income" id="income" size="20" value="22000$" type="text"></div>';
var selector = 'input[name=fullname]';
alert($(selector, body).val());
var body='';
变量选择器='input[name=fullname]';
警报($(选择器,正文).val());
编辑:。

jQuery到救援:

var body = '<div><input name="fullname" id="fullname" size="20" value="David Smith" type="text"><input name="age" id="age" size="2" value="32" type="text"><input name="income" id="income" size="20" value="22000$" type="text"></div>';
var selector = 'input[name=fullname]';
alert($(selector, body).val());
var body='';
变量选择器='input[name=fullname]';
警报($(选择器,正文).val());
编辑: