有网站有:
<html>
<body>
<form action="/action_page.php">
First name: <div class="col-md-8 col-sm-8 col-xs-6"><strong><input type="text" class="no-style" value="John"></strong></div>
Last name: <div class="col-md-8 col-sm-8 col-xs-6"><strong><input type="text" class="no-style" value="Miller"></strong></div>
Email: <div class="col-md-8 col-sm-8 col-xs-6"><strong><input type="text" class="no-style" value="[email protected]"></strong></div>
<input type="submit" value="Send">
</form>
</body>
</html>
是否有可能从输入值(John,Miller,j.miller @ gmail.com)中抓取数据并将其显示在我的页面中(可能将该网站放入iframe并从中删除?)或者可能使用以下内容:
// Get HTML from page
$.get( 'http://example.com/', function( html ) {
// Loop through elements you want to scrape content from
$(html).find("ul").find("li").each( function(){
var text = $(this).text();
// Do something with content
} )
} );
我不知道。我对javascript不好。还有奖励:每次刷新的输入值都不同。我可以从100刷新或某种东西中提取某种数据吗?感谢您的任何帮助!
我将假设您需要从输入元素获取数据,然后在您的站点中的其他位置使用它
你可以使用jquery .val()函数轻松完成
这是一些示例代码
<form id="my-form">
name: <input type="text" id='test-input'/>
<input type="submit" />
</form>
<script>
var input;
$('#my-form').on('submit', function() {
input = $('#test-input').val();
});
</script>
然后,您可以随意使用变量,无论是缓存数据还是改善用户体验
获取值和var _value = $('#elementId').val();
并在页面的任何位置使用它$('#elementID').val(_value);
或$('selector').text(_value);