我正在尝试在弹出屏幕上显示结果,但我不知道要放入de'()'。希望你的家伙可以帮我解决这个问题。谢谢:D
<script>
// JavaScript popup window function
function basicPopup(url) {
popupWindow = window.open(url,'action','height=550,width=800,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes')
}
</script>
<form method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<table bgcolor="#FFFFFF">
<input Type=text name=q size=31 maxlength=255 value="">
<input Type=submit name=btnG value="Search" onclick="basicPopup();return false">
<font size=-1>
<input type=hidden name=domains value="google">
<input type=hidden name=sitesearch value="google.com" checked>
</font>
</table>
</form>
答案 0 :(得分:0)
在 onclick =&#34; basicPopup(); 中传递要传递这些值的html网页或网址网址。
ex. onclick="basicPopup('D:\new.html');
答案 1 :(得分:0)
我正在完全修改我的答案,因为我原本不明白你是想把整个表格发布到弹出窗口。
您需要为表单命名,以便可以从javascript中引用它。然后,您需要在创建弹出窗口后访问该表单,并将其目标更改为新创建的弹出窗口。最后,您以编程方式提交表单,然后将其发布到弹出窗口中。
以下是这些更改后的代码:
<script>
// JavaScript popup window function
function basicPopup(url) {
popupWindow = window.open(url, 'action', 'height=550,width=800,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes')
document.searchform.setAttribute('target', 'action');
document.searchform.setAttribute('onsubmit', '');
document.searchform.submit();
}
</script>
<form method=GET name="searchform" action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<table bgcolor="#FFFFFF">
<input type=text name=q id=q size=31 maxlength=255 value="">
<input type=submit name=btnG value="Search" onclick="basicPopup('about:blank'); return false">
<font size=-1>
<input type=hidden name=domains value="google">
<input type=hidden name=sitesearch value="google.com" checked>
</font>
</table>
</form>
我使用了以下SO问题作为参考:How do I submit an HTML form to a Popup windows with resize disabled?
答案 2 :(得分:0)
这是你想要的:
JsFiddle: http://jsfiddle.net/G4T8Z/
<强> JavaScript的:强>
<script>
// JavaScript popup window function
function basicPopup(url) {
popupWindow = window.open(url,'action','height=550,width=800,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes')
}
</script>
HTML:
<form method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<table bgcolor="#FFFFFF">
<input Type=text name=q id=q size=31 maxlength=255 value="">
<input type=submit name=btnG value="Search" onclick="basicPopup('https://www.google.bg/search?q=' + document.getElementById('q').value); return false"> <font size=-1>
<input type=hidden name=domains value="google">
<input type=hidden name=sitesearch value="google.com" checked>
</font>
</table>
</form>