• js入门·打开/关闭指定URL的窗口/改变链接时候状态栏的文字


    没什么好说的了,直接看代码吧!有什么不明白,留言,我会当天回复!

    <%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>打开指定URL的窗口/改变链接时候状态栏的文字</title>
    <script language="javascript">
    /*申明一个代表窗体对象的变量,这是关键,他作为全局变量,后面两个函数都可以访问他
    不赋值,也表示该值为null ,在if的时候就是false 
    */

    var Wind;
    function newWindow(url)
    {//这里申明一个根据传来的地址打开新窗口的函数
        Wind=window.open(url,"","width=400,height=300");//将打开的窗口对象作为值赋给Wind对象,括号里意思(地址,长宽)
    }

    function closeWind()
    {//关闭打开的新窗口,否则提示
        if(Wind)//如果Wind对象存在
        {
            Wind.close();
    //调用关闭方法
            Wind=null//并把值赋成null
        }

        
    else
        
    {//否则,也就是
            alert("你去天轰穿的博客再找点教程看,有办法关闭不存在的窗口不嘛!");
        }

    }

    </script>
    </head>

    <body>
    <p>
      
    <input type="submit" name="tijiao" value="打开天轰穿博客" onclick="newWindow('http://thcjp.cnblogs.com')" />
    </p>
    <p>
      
    <input type="submit" name="close" value="关闭刚才打开的窗口" onclick="closeWind()" />
    </p>
    <p><href="http://thcjp.cnblogs.com" onmouseover="window.status='这里有很多你想要的东西';return true;">天轰穿.net\js入门</a>(如果你细心的话,你可以发现,当鼠标离开后,状态栏并没有还原,想知道怎么做?请去http://thcjp.cnblogs.com找答案吧!)</p>
    </body>
    </html>
  • 相关阅读:
    王道考研复习-操作系统-进程管理(二)
    王道考研复习-操作系统-计算机系统概述(一)
    Understanding Undefined Behavior
    iOS开发需要掌握的命令
    LLDB命令速查
    Flutter简介
    poj 2115 C Looooops 扩展欧几里得算法
    poj 2635 The Embarrassed Cryptographer ??/Java??(???)
    poj 3292 Semi-prime H-numbers 筛素数(简单题)
    poj 1019 Number Sequence 数学
  • 原文地址:https://www.cnblogs.com/thcjp/p/468017.html
Copyright © 2020-2023  润新知