首页 > Web开发 > 详细

js打开、关闭页面和运行代码那些事

时间:2014-12-14 19:52:06      阅读:214      评论:0      收藏:0      [点我收藏+]
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="智能社 - zhinengshe.com">
<meta name="copyright" content="智能社 - zhinengshe.com">
<title>智能社 - www.zhinengshe.com</title>
</head>
<body>
    <input type="button" value="打开" onclick="window.open(‘http://www.baidu.com‘), ‘_self‘" />
    <input type="button" value="关闭" onclick="window.close();" />
</body>
</html>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="智能社 - zhinengshe.com">
<meta name="copyright" content="智能社 - zhinengshe.com">
<title>智能社 - www.zhinengshe.com</title>
<style>

</style>
<script>
window.onload=function (){
    var oBtn=document.getElementById(btn);
    var oText=document.getElementById(text);    
    oBtn.onclick=function (){
        var oNewWidnow=window.open(about:blank, _blank);    
        oNewWidnow.document.write(oText.value);
    };
    
};
</script>
</head>

<body>
    <textarea cols="80" rows="10" id="text"></textarea>
    <input type="button" value="运行" id="btn" />
</body>
</html>

bubuko.com,布布扣bubuko.com,布布扣

js打开、关闭页面和运行代码那些事

原文:http://www.cnblogs.com/heboliufengjie/p/4162831.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!