ajax学习篇6
showModalDialog这个对话框。 利用这个可以对对话框和父界面进行信息交互。 window.showModelessDialog(sURL[,vArguments] [,sFeatures]) window.dialogArguments来取得传递进来的参数。
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type"content="text/html; charset=UTF-8"> <title>Inserttitle here</title> <scripttype="text/javascript"> window.onload=function(){ document.getElementById("button").onclick=function(){
window.showModalDialog("otherpage.html",window,"dialogWidth=200px;dialogHeight=100px"); }//利用这个方法,我们可以弹出一个otherpage.Html这里的window参数是该页面的所有内容。后面的是对窗口风格的设置。 } 这个是:otherpage.html </script> </head> <body> <inputtype="text" id="username"> <inputtype="button" value="确定" id="button"/> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTDHTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type"content="text/html; charset=UTF-8"> <title>Insert title here</title> <script type="text/javascript"> window.onload = function() { var obj = window.dialogArguments;//利用这句话我们可以把其那面的window参数接受过来。 var a = document.getElementById("hello").value;//获取自己元素的值 var b = obj.document.getElementById("username").value;//既然参数就是一个window那么获取父窗口的值方法也是一样的,。 //b = a; //alert(b); obj.document.getElementById("username").value = a;//将这个界面的值传给了父页面。 } </script> </head> <body> <input type="text"value="你好" id="hello"> </body> </html> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |