<%
@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 >< a href ="http://thcjp.cnblogs.com" onmouseover ="window.status='这里有很多你想要的东西';return true;" > 天轰穿.net/js入门 </ a > (如果你细心的话,你可以发现,当鼠标离开后,状态栏并没有还原,想知道怎么做?请去http://thcjp.cnblogs.com找答案吧!) </ p >
</ body >
</ html >
<! 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 >< a href ="http://thcjp.cnblogs.com" onmouseover ="window.status='这里有很多你想要的东西';return true;" > 天轰穿.net/js入门 </ a > (如果你细心的话,你可以发现,当鼠标离开后,状态栏并没有还原,想知道怎么做?请去http://thcjp.cnblogs.com找答案吧!) </ p >
</ body >
</ html >