gpt4 book ai didi

php - 如何创建单击“提交”按钮后打开网页的在线表单

转载 作者:行者123 更新时间:2023-11-28 20:40:25 25 4
gpt4 key购买 nike

我想制作一个表单,可以在其中输入域名,然后单击提交按钮,并将域名合并到 Google、Bing、Yahoo 等地方的搜索结果 URL 的一部分中。单击提交后按钮 我希望使用 iframe 将结果显示在页面底部。

编辑:我希望使用 iframe 将结果显示在页面底部,而不是打开新选项卡。这可能吗?这是迄今为止更新的代码:

<!DOCTYPE html>
<html>
<head>
<title>Domain Checker</title>
<meta name="description" content="Get useful information about a domain name." />
</head>
<body>

<h1>Domain Checker</h1>
<p>Use the domain checker to get useful information about a domain name. Type the domain name you want to check and hit enter.</p>

<script type='text/javascript'>
function openWindow(url)
{
var domain2 = document.getElementById('domain2').value;
window.open(url + domain2);
}
</script>

<form method='post'>
<label>Domain</label><input type='text' name='domain2' id='domain2'>
<select name="select" onChange="openWindow(this.options[this.selectedIndex].value)">
<option>Choose Below</option>
<option value="http://www.dmoz.org/search?q=">DMOZ</option>
<option value="https://flippa.com/valuation/">Flippa</option>
<option value="http://web.archive.org/web/*/">WayBack</option>
<option value="http://www.alexa.com/siteinfo/">Alexa</option>
<option value="https://www.google.com/search?&q=site:">Google Index</option>
<option value="https://www.google.com/search?&q=link:">Google Backlinks</option>
<option value="http://search.yahoo.com/search?p=site:">Yahoo Index</option>
<option value="http://search.yahoo.com/search?p=link:">Yahoo Backlinks</option>
<option value="http://www.bing.com/search?q=site:">Bing Index</option>
<option value="http://www.bing.com/search?q=site:">Bing Backlinks</option>
<option value="http://whois.domaintools.com/">Whois Info</option>
</select>
</form>
<hr>
<p>Results show here in iframe.</p>
</body>
</html>

最佳答案

<script type='text/javascript'>
function openWindows(domain)
{
if (domain) {
window.open('http://www.dmoz.org/search?q=' + domain);
window.open('https://flippa.com/valuation/' + domain);
window.open('http://web.archive.org/web/*/' + domain);
window.open('http://www.alexa.com/search?q=' + domain);
window.open('https://www.google.com/search?&q=site:' + domain);
}
}
</script>
<form action='your_form_processor.html' method='post' onsubmit="openWindows(document.getElementById('domain').value)">
<label>Domain</label><input type='text' name='domain' id='domain'>
</form>

关于php - 如何创建单击“提交”按钮后打开网页的在线表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14507412/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com