问题见内~很简单,请问怎么实现?

QYworld 2002-02-22 08:36:56
这是代码:

<form name="article" method="post" action="add.asp">
<p> 标题:
<input type="text" name="textfield">
<br>
内容:
<textarea name="content"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="提交">
<input type="button" name="preview" value="预览" onclick="document.article.action='per.asp';document.article.target='_blank';document.article.submit();document.article.action='add.asp';document.article.target='_self'">
</p>
</form>

我是想在点击预览按钮时,能弹出个可定义大小的窗口,是不是要用window.open函数,该怎么做?上面那段代码只能弹出普通窗口。
...全文
57 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
karma 2002-02-23
  • 打赏
  • 举报
回复
my method allows you to POST data back to per.asp

there is another way, to post the data using
<input type="button" name="preview" value="预览"
onclick="document.article.action='per.asp';document.article.target='_blank';document.article.submit();">

but inside "per.asp",
use
window.open("another.asp","_blank",
"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
window.close();

to pop out another window, and then close itself
QYworld 2002-02-23
  • 打赏
  • 举报
回复
karma(无为) ,先给你结分了

但你的方法我不太明白“and you want to use POST too?”为什么这么问?
希偌 2002-02-23
  • 打赏
  • 举报
回复
window.open('main.asp','聊天室','top=0,left=0,menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=0,scrollbars=0,width=200,height=200')

karma 2002-02-23
  • 打赏
  • 举报
回复
and you want to use POST too?

use XMLHTTP:

<script language="javascript">
function doSubmit()
{
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("POST","per.asp",false);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.send("content="+document.article.content.value+"&textfield="+document.article.textfield.value);

var win = window.open("","_blank",
"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
win.document.open();
win.document.write(xmlhttp.responseText);
win.document.close();
// alert(xmlhttp.responseText);
}
</script>

<form name="article" method="post" action="add.asp">
<p> 标题:
<input type="text" name="textfield">
<br>
内容:
<textarea name="content"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="提交">
<input type="button" name="preview" value="预览"
onclick="doSubmit()">
</p>
</form>
QYworld 2002-02-23
  • 打赏
  • 举报
回复
不是的

需要弹出的窗口能得到<input type="text" name="textfield">和<textarea name="content"></textarea>的值
karma 2002-02-23
  • 打赏
  • 举报
回复
example:

window.open("Sample.htm",null,
"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
flylyke 2002-02-22
  • 打赏
  • 举报
回复
function MM_openBrWindow(theURL,winName,features) {
window.open(theURL,winName,features);
}
</SCRIPT>

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧