You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
klintersrv/editor/dialog/hyperlink.htm

194 lines
4.7 KiB

3 months ago
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language=javascript src="dialog.js"></script>
<link href='dialog.css' type='text/css' rel='stylesheet'>
<title><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></title>
<script Language=javascript>
var sAction = URLParams['action'];
var sTitle = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
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;
adjustDialog();
}
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);
}
}
}
function ok(){
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("<EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>");
d_url.focus();
return;
}
window.close();
}
</script>
</HEAD>
<body onload="InitDocument()">
<table border=0 cellpadding=0 cellspacing=5 id=tabDialogSize><tr><td>
<table border=0 cellpadding=0 cellspacing=0 align=center>
<tr>
<td>
<fieldset>
<legend><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ</legend>
<table border=0 cellpadding=5 cellspacing=0 width="100%">
<tr><td>
<table border=0 cellpadding=0 cellspacing=2 width="100%">
<tr>
<td noWrap width="20%"><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:</td>
<td noWrap width="29%">
<select id=d_protocol onchange="changeProtocol(this.selectedIndex)" size=1 style="width:80px">
<option value=''><EFBFBD><EFBFBD><EFBFBD><EFBFBD></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="2%">&nbsp;</td>
<td noWrap width="20%"><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD>:</td>
<td noWrap width="29%">
<select id=d_target size=1 style="width:80px">
<option value=''>Ĭ<EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>)</option>
<option value='_self'><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD></option>
<option value='_top'><EFBFBD><EFBFBD>ҳ</option>
<option value='_blank'><EFBFBD>½<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></option>
<option value='_parent'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></option>
</select>
</td>
</tr>
<tr>
<td noWrap width="20%"><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>ַ:</td>
<td noWrap width="80%" colspan=4><input type=text id=d_url size=10 value="" style="width:100%"></td>
</tr>
<tr>
<td noWrap width="20%"><EFBFBD><EFBFBD>ǩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:</td>
<td noWrap width="80%" colspan=4>
<select id=d_anchor onchange="d_url.value=this.options[this.selectedIndex].value" size=1 style="width:100%">
<option value=''>Ĭ<EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>)</option>
</select>
</td>
</tr>
</table>
</td></tr>
</table>
</fieldset>
</td>
</tr>
<tr><td height=5></td></tr>
<tr><td noWrap align=right><input type=submit value=<EFBFBD><EFBFBD>' id=Ok onclick="ok()">&nbsp;&nbsp;<input type=button value=<EFBFBD><EFBFBD>' onclick="window.close();"></td></tr>
</table>
</td></tr></table>
</BODY>
</HTML>