?? hyperlink.htm
字號:
<HTML>
<HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<style type="text/css">
body, a, table, div, span, td, th, input, select{font:9pt;font-family: "宋體", Verdana, Arial, Helvetica, sans-serif;}
body {padding:5px}
</style>
<Script Language=JavaScript src="dialog.js"></script>
<Script Language=JavaScript>
var sAction = URLParams['action'];
var sTitle = "插入";
var objWindow;
var oRange;
var sType;
var oSel;
var sUrl = "http://";
var sProtocol = "http://";
var sTarget = "";
switch (sAction){
case "other":
sUrl = dialogArguments.objLink.Href;
sTarget = dialogArguments.objLink.Target;
sProtocol = getProtocol(sUrl);
objWindow = dialogArguments.opener;
break;
default:
oRange = dialogArguments.eWebEditor.document.selection.createRange();
sType = dialogArguments.eWebEditor.document.selection.type;
if (sType == "Control") {
oSel = oRange(0).parentNode;
}else{
oSel = oRange.parentElement();
}
if (oSel.tagName.toUpperCase() == "A"){
sTarget = oSel.target;
sUrl = oSel.getAttribute("href",2);
sProtocol = getProtocol(sUrl);
}
objWindow = dialogArguments;
break;
}
// 從地址取協議
function getProtocol(url){
var re=/(.+:\/*)(.*)/gi;
return url.replace(re,"$1");
}
// 改變協議
function changeProtocol(index){
sProtocol=d_protocol.options[index].value;
sUrl = d_url.value;
var re = /(.+:\/*)/gi;
sUrl = sUrl.replace(re, "");
d_url.value = sProtocol + sUrl;
}
// 初始值
function InitDocument(){
SearchSelectValue(d_protocol, sProtocol.toLowerCase());
SearchSelectValue(d_target, sTarget.toLowerCase());
getAnchors();
d_url.value = sUrl;
}
// 取所有的錨
function getAnchors() {
d_anchor.options.length = 1;
var allLinks = objWindow.eWebEditor.document.body.getElementsByTagName("A");
for (i=0; i < allLinks.length; i++) {
if (allLinks[i].href.toUpperCase() == "") {
d_anchor.options[d_anchor.options.length] = new Option(allLinks[i].name,"#"+allLinks[i].name);
}
}
}
</Script>
<title>超級鏈接屬性</title>
<SCRIPT event=onclick for=Ok language=JavaScript>
sUrl = d_url.value;
sProtocol = d_protocol.options[d_protocol.selectedIndex].value;
sTarget = d_target.options[d_target.selectedIndex].value;
if (sUrl != ""){
switch (sAction){
case "other":
var arr = new Array();
arr[0] = sUrl;
arr[1] = sTarget;
window.returnValue = arr;
break;
default:
oRange.execCommand("CreateLink",false,sUrl);
oRange = dialogArguments.eWebEditor.document.selection.createRange();
sType = dialogArguments.eWebEditor.document.selection.type;
if (sType == "Control") {
oSel = oRange(0).parentNode;
}else{
oSel = oRange.parentElement();
}
if (sTarget != ""){
oSel.target = sTarget;
}else{
oSel.removeAttribute("target");
}
window.returnValue = null;
break;
}
} else {
alert("鏈接地址不能為空");
d_url.focus();
return;
}
window.close();
</SCRIPT>
</HEAD>
<body bgcolor=menu onload="InitDocument()">
<table border=0 cellpadding=0 cellspacing=0 align=center>
<tr>
<td>
<fieldset>
<legend>超級鏈接信息</legend>
<table border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=9 height=5></td></tr>
<tr>
<td width=7></td>
<td noWrap>鏈接類型:</td>
<td width=5></td>
<td><select id=d_protocol style="width:72px" onchange="changeProtocol(this.selectedIndex)">
<option value=''>其它</option>
<option value='file://'>file:</option>
<option value='ftp://'>ftp:</option>
<option value='gopher://'>gopher:</option>
<option value='http://'>http:</option>
<option value='https://'>https:</option>
<option value='mailto:'>mailto:</option>
<option value='news:'>news:</option>
<option value='telnet:'>telnet:</option>
<option value='wais:'>wais:</option>
</select></td>
<td width=40></td>
<td noWrap>鏈接目標:</td>
<td width=5></td>
<td><select id=d_target style="width:72px"><option value=''>默認(無)</option><option value='_self'>相同框架</option><option value='_top'>整頁</option><option value='_blank'>新建窗口</option><option value='_parent'>父框架</option></select></td>
<td width=7></td>
</tr>
<tr><td colspan=9 height=5></td></tr>
<tr>
<td width=7></td>
<td>鏈接地址:</td>
<td width=5></td>
<td colspan=5><input type=text id=d_url size=38 value="" style="width:243px"></td>
<td width=7></td>
</tr>
<tr><td colspan=9 height=5></td></tr>
<tr>
<td width=7></td>
<td>書簽鏈接:</td>
<td width=5></td>
<td colspan=5><select id=d_anchor onchange="d_url.value=this.options[this.selectedIndex].value"><option value=''>默認(無)</option></select></td>
<td width=7></td>
</tr>
<tr><td colspan=9 height=5></td></tr>
</table>
</fieldset>
</td>
</tr>
<tr><td height=5></td></tr>
<tr><td align=right><input type=submit value=' 確定 ' id=Ok> <input type=button value=' 取消 ' onclick="window.close();"></td></tr>
</table>
</BODY>
</HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -