Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/401.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/8/variables/2.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/0/amazon-s3/2.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 将textbox变量传递给URL,然后在iframe中打开_Javascript_Variables_Url_Iframe - Fatal编程技术网

Javascript 将textbox变量传递给URL,然后在iframe中打开

Javascript 将textbox变量传递给URL,然后在iframe中打开,javascript,variables,url,iframe,Javascript,Variables,Url,Iframe,我有一个脚本,下面是我用来向URL传递变量的脚本。当我单击搜索按钮时,它会重定向到包含文本框中变量的URL,但是我需要做的是在搜索框下方打开的iframe中打开页面,以便我可以在框仍然可见的情况下再次搜索。 任何帮助都将不胜感激。 非常感谢,, Martyn.p.S.我已经从URL中删除了电子表格代码 <!DOCTYPE html> <html> <body> Search by word (case sensitive):<br> <inp

我有一个脚本,下面是我用来向URL传递变量的脚本。当我单击搜索按钮时,它会重定向到包含文本框中变量的URL,但是我需要做的是在搜索框下方打开的iframe中打开页面,以便我可以在框仍然可见的情况下再次搜索。 任何帮助都将不胜感激。 非常感谢,, Martyn.p.S.我已经从URL中删除了电子表格代码

<!DOCTYPE html>
<html>
<body>
Search by word (case sensitive):<br>
<input type="text" id="urlInput" value="">
<input type="hidden" id="urlInput2" value="%22">


<button onclick="redirect()">Search</button>

<script>
function redirect() {
var url = "https://docs.google.com/spreadsheets/d/XXXXXXXXXXXXXXXXXX/gviz/tq?tqx=out:html&tq=SELECT%20*%20where%20B%20contains%20%22" + document.getElementById('urlInput').value + document.getElementById('urlInput2').value;
window.location=url;
}
</script>

</body>
</html>
你想要这个吗

函数重定向{ 变量url=https://docs.google.com/spreadsheets/d/XXXXXXXXXXXXXXXXXX/gviz/tq?tqx=out:html&tq=SELECT%20*%20其中%20B%20包含%20%22+document.getElementById'urlInput'。值+document.getElementById'urlInput2'。值; getElementById'iframe'.src=url; } iframe{ 宽度:100%; 身高:80%; } 按单词大小写搜索: 搜索
这正是我想要的!非常感谢@xianshenglu