zoukankan      html  css  js  c++  java
  • 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>
  • 相关阅读:
    真情感动看上海新闻娱乐频道“百家心”
    Treeview Navigation Web Part for SharePoint with SmartPart v1.0
    轻松玩转Typed DataSet, Part III
    微软Avalon和WinForms的发展蓝图
    Proxy Pattern using C#
    System.Threading.Timer类的TimerCallback 委托
    SmartPart v1.0 for SharePoint [Free Web Part]
    分布式应用架构中的数据传输对象(DTO)
    定制SharePoint Portal Server 2003站点的向导
    Bridge Pattern using C#
  • 原文地址:https://www.cnblogs.com/thcjp/p/468017.html
Copyright © 2011-2022 走看看