将参数传递给新选项卡的搜索框,然后显示结果 [英] pass parameters to new tab's search box and then show the results
本文介绍了将参数传递给新选项卡的搜索框,然后显示结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是搜索页面
< head >
< title > Untitled Document < / title >
< meta http-equiv = 内容类型 内容 = text / html; charset = iso-8859-1 / >
< script 类型 = text / javascript >
function submitSearch(){
alert( document .getElementById(' searchString') .value);
document .cookie = escape ( document .getElementById(' searchString')。value);
window .open( http:// localhost:8080 /GPS_Integration/test/test1.html跨度>);
}
< / script >
< / head >
< 正文 >
< 表格 >
< tr >
< td width = 140 > < 输入 类型 = text name = searchString id = searchString class = smallFont style = width:135px; / > < / td >
< td width = 25 align = right > < 输入 type = 提交 名称 = searchButton id = searchButton onclick = submitSearch() / > < / td >
< / tr >
< / table >
< / body >
这是打开的下一页......但它没有显示结果..
< head >
< script < span class =code-attribute> type = javascript >
function getcookie()
{
var cookie = unescape ( document .cookie);
document .getElementById( pac-input )。value = cookie;
}
< / script >
< / head >
< 正文 önload = getcookie(); >
< table >
< tr >
< td width = 140 > < 输入 type = text 名称 = searchString id = searchString < span class =code-attribute> class = smallFont style = width:135px; / > < / td >
< td width = 25 align = right > < span class =code-keyword>< input type = submit name = searchButton id = searchButton / > < / td >
< / tr >
< < span class =code-leadattribute> / table >
< / body >
解决方案
传递URL上的参数。然后,告诉我们到底出了什么问题(代码没有找到参数,不能正确搜索等)
hey guys m working on a students project and i want code for " there is a search box . when we enter text in it and push the search button it must open a new tab where the main page with another search box will be there and the search text will be copied from previous search box and it must show the results of the entered text."
This is the search page
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript">
function submitSearch() {
alert(document.getElementById('searchString').value);
document.cookie = escape(document.getElementById('searchString').value);
window.open("http://localhost:8080/GPS_Integration/test/test1.html");
}
</script>
</head>
<body>
<table>
<tr>
<td width="140"><input type="text" name="searchString" id="searchString" class="smallFont" style="width: 135px;" /></td>
<td width="25" align="right"><input type="submit" name="searchButton" id="searchButton" onclick="submitSearch()" /></td>
</tr>
</table>
</body>
This is the next page which opens ...but it doesnt show the results..
<head>
<script type="javascript">
function getcookie()
{
var cookie = unescape(document.cookie);
document.getElementById("pac-input").value = cookie;
}
</script>
</head>
<body önload="getcookie();">
<table>
<tr>
<td width="140"><input type="text" name="searchString" id="searchString" class="smallFont" style="width: 135px;" /></td>
<td width="25" align="right"><input type="submit" name="searchButton" id="searchButton" /></td>
</tr>
</table>
</body>
解决方案
Pass the parameters on the URL. Then, tell us exactly what goes wrong ( does the code not find the parameters, does it not search properly, etc )
这篇关于将参数传递给新选项卡的搜索框,然后显示结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文