I have got the script below which I am using to pass a variable to a URL. When I click the search button it redirects to the URL including the variable in the text box however what I need to do is open the page in an iframe that opens beneath the search box so I can search again with the box still visible.
Any assistance would be much appreciated.
Many thanks,
Martyn.
PS I have removed the spreadsheet code from the 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>
did you want this?
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; document.getElementById('iframe').src = url; }
#iframe { width: 100%; height: 80%; }
Search by word (case sensitive):<br> <input type="text" id="urlInput" value=""> <input type="hidden" id="urlInput2" value="%22"> <button onclick="redirect()">Search</button> <iframe src="https://cn.bing.com/?scope=web" id="iframe"></iframe>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.