链接类

VML

按钮类

标题类

表单类

表格类

菜单类

窗口类

对象类

滚动条

键盘类

框架类

例子类

模拟类

日期类

色彩类

鼠标类

数学类

图片类

文字类

下拉框

样式类

游戏类

状态栏

资料类

字幕类

其它类

 ·样式控制窗口目标
 ·链接Loading效果
 ·本地文件夹链接
 ·后退无效的链接
 ·链接效果
 ·判断链接是否被访问
 ·自动刷新
 ·查看当前页面的源代码
 ·链接确认警告
 ·about语法
您当前位置:好素材首页 -> 网页特效 -> 链接类
查看信息

CreateLink的目标窗口
好素材网 www.HaoSc.com 02月22日 11:49

[查看演示]  源码如下
----------------------------------------------------------
<script>if( self == top ){top.location = "/myjs/?u=/hw/asp/jsview.asp?id=311";}</script>
<HTML>
<HEAD>
<TITLE>CreateLink的目标窗口-www.51windows.Net</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META NAME="Author" CONTENT="51windows,海娃,haiwa">
<META NAME="Description" CONTENT="Power by 51windows.Net">
</HEAD>
<BODY>
<H1 unselectable="on">Creating a Link and Retrieving the URL</H1>
<script>
function AddLink()
{
var sText = document.selection.createRange();
if (!sText=="")
{
if (document.execCommand("CreateLink"))
{
if(confirm("目标框架在新窗口吗?"))
{
sText.parentElement().outerHTML=sText.parentElement().outerHTML.replace("<A","<A target=\"_blank\"");
}
}
}
else
{
alert("Please select some blue text!");
}
}
</script>
<P unselectable="on">Select any portion of the following blue text, such as "My favorite Web site". Click the button to turn the selected text into a link. The text will be changed to the URL that you specify.</P>
<P style="color=#3366CC">My favorite Web site is worth clicking on. Don't forget to check out my favorite music group!</P>

<BUTTON onclick="AddLink()" unselectable="on">Click to add link</BUTTON>
</BODY>
</HTML>
<div style="position: absolute; top: 10; right: 10; width: 148; height: 18;cursor:hand;z-index:100000;font:menu;">
<A href="http://www.51windows.Net/?js" target=_blank><FONT color=red> My Js Collection!</FONT></A><br><input type="button" name="Button" value="源代码" onClick= 'window.location = "view-source:" + window.location.href'><SCRIPT LANGUAGE="JavaScript" src="/log/sitelog.asp"></SCRIPT></div>
<!-- 海娃@haiwa@blueidea.com@无忧视窗@http://www.51windows.net -->


<div style="position: absolute; top: 10; right: 10; width: 148; height: 18;cursor:hand">
<input type="button" name="Button" value="查看源代码" onClick= 'window.location = "view-source:" + window.location.href'></div>


此信息共 1 页 [1]