1. 用表单提交
2. 直接在 frameset 网页里这样写:
window.onbeforeunload = function()
{
alert("meizz");
}
2. 直接在 frameset 网页里这样写:
window.onbeforeunload = function()
{
alert("meizz");
}
解决方案 »
- 如何自动获取页面上的对象的属性(new)
- js 总是获得不到frame对象或者frameset对象,请教??
- 用packer 压缩js 不想没有备份 请问怎么还原?
- 关于不同分页上的checkbox的问题
- 怎样让一个文本框的内容在被点击 或者 获得焦点后 内容全选高亮显示或直接消失
- javascript连接数据库问题[急]100分 100分 100分
- 我有一个table,我想在上面的tr中使用相对定位,下面的tr中用绝对定位,用javascript实现,怎么不行呀!
- 帮我看看我的代码 :)
- 如何在asp中的函数中写删除语句,在线等待
- 网站通过用户机在局域网内通信
- 如何利用鼠标的滑轮控制图片的放大与缩小?
- 欣赏一下外国的datagrid(附地址)
2.写在frame中的body里也可以
to vivianfdlpw() :XML我还没接触过,现在功能要的急,所以只有等以后有空了再学习:),至于你说的在frame的body中是指frame里面的其他网页的body里吗?to meizz(梅花雪):第一个用表单提交,比如我现在是如下:
<html>
<head>
<script language=javascript>
function p()
{
var x=location.href;
}
</script>
</head>
<body>
<form>
</form>
</body>
</html>
请问我如何把x的值传回给服务器??
function p()
{
var x=location.href;
var url="http://url"+"&x="+x;
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("post",url,false);
xmlhttp.send();
}
</script>
:)
不明白,你传给服务器干什么?
location.href="http://xxx"网页就自动跳转了。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><!-- Fig. 10.4: welcome.jsp -->
<!-- JSP that processes a "get" request containing data. --><html xmlns = "http://www.w3.org/1999/xhtml"> <!-- head section of document -->
<head>
<title>Processing "get" requests with data</title>
</head> <!-- body section of document -->
<body>
<% // begin scriptlet String name = request.getParameter( "firstName" ); if ( name != null ) { %> <%-- end scriptlet to insert fixed template data --%> <h1>
Hello <%= name %>, <br />
Welcome to JavaServer Pages!
</h1> <% // continue scriptlet } // end if
else { %> <%-- end scriptlet to insert fixed template data --%> <form action = "welcome.jsp" method = "get">
<p> Type your first name and press Submit</p>
<p><input type = "text" name = "firstName" />
<input type = "submit" value = "Submit" />
</p>
</form> <% // continue scriptlet
} // end else %> <%-- end scriptlet --%>
</body></html> <!-- end XHTML document --><!--
***************************************************************
* (C) Copyright 2002 by Deitel & Associates, Inc. and *
* Prentice Hall. All Rights Reserved. *
* *
* DISCLAIMER: The authors and publisher of this book have *
* used their best efforts in preparing the book. These *
* efforts include the development, research, and testing of *
* the theories and programs to determine their effectiveness. *
* The authors and publisher make no warranty of any kind, *
* expressed or implied, with regard to these programs or to *
* the documentation contained in these books. The authors *
* and publisher shall not be liable in any event for *
* incidental or consequential damages in connection with, or *
* arising out of, the furnishing, performance, or use of *
* these programs. *
***************************************************************
-->
这是一个“hello world”程序。
不过要用到其他的容器,比如tomcat,weblogic,resin等等。
你上网看一下吧,例子多的是
//提交xml数据
var xmlDoc = new ActiveXObject("MSXML2.DOMDocument");
xmlDoc.async=false;
xmlDoc.load("loadXML.xml");
//alert(xmlDoc.xml);
var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
var url = 'Hospital.XMLData.cls';
xmlhttp.open("post", url, false);
startstop(); //计时开始
xmlhttp.send(xmlDoc);
alert(xmlhttp.responseText);