alert或者confirm
如果你是想弹出层。那也很简单。先用样式写好这个层,手机页面可以直接用position:fixed来定位。pc页面ie6不兼容这个样式,只能用绝对定位和样式表达式来做。
当你想弹层时,用js把这个层的display改成block就可以了。关闭则设这个层的display为none。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML>
<HEAD>
<TITLE>New Document </TITLE>
<META content="EditPlus" name="Generator">
<META content="" name="Author">
<META content="" name="Keywords">
<META content="" name="Description">
<script language="javascript">
<!--
function openChild(){
var aa = document.getElementById("txt9").value
var k = window.showModalDialog("child.html",aa,"dialogWidth:335pxstatus:nodialogHeight:300px")
if(k != null)
document.getElementById("txt11").value = k
}
//-->
</script>
</HEAD>
<BODY>
<FONT face="宋体"></FONT>
<br>
传递到父窗口的值:<input id="txt9" type="text" value="33333" name="txt9"><br>
返回的值:<input id="txt11" type="text" name="txt11"><br>
子窗口设置的值:<input id="txt10" type="text" name="txt10"><br>
<input id="Button1" onclick="openChild()" type="button" value="openChild" name="Button1">
</BODY>
</HTML>
child.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>New Document </TITLE>
<META content="EditPlus" name="Generator">
<META content="" name="Author">
<META content="" name="Keywords">
<META content="" name="Description">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Pragma" content="no-cache">
</HEAD>
<BODY>
<FONT face="宋体"></FONT>
<br>
父窗口传递来的值:<input id="txt0" type="text" name="txt0"><br>
输入要设置父窗口的值:<input id="txt1" type="text" name="txt1"><input id="Button1" onclick="setFather()" type="button" value="设置父窗口的值" name="Button1"><br>
输入返回的值:<input id="txt2" type="text" name="txt2"><input id="Button2" onclick="retrunValue()" type="button" value="关闭切返回值" name="Button2">
<input id="Button3" onclick="" type="button" value="关闭刷新父窗口" name="Button3">
<script language="javascript">
<!--
var k=window.dialogArguments
//获得父窗口传递来的值
if(k!=null)
{
document.getElementById("txt0").value = k.document.getElementById("txt9").value
}
//设置父窗口的值
function setFather()
{
k.document.getElementById("txt10").value = document.getElementById("txt1").value
}
//设置返回到父窗口的值
function retrunValue()
{
var s = document.getElementById("txt2").value
alert(s)
window.returnValue=s
window.close()
}
//-->
</script>
</BODY>
</HTML>