Hi! I have a anoying problem with my editor!
What i want to do is make a popup that holds a string for the "hyperlink"
window...
I have a popup to do this before, and it works perfecty, but in order to
make it work, I have to know the adress of the box I wanna put the value
back in to...
I have this so far :)
window.opener.i dLinkURL.value;
But it will not work.
Guess it is wrong adress for my input box.
maby some strange adresses since i'm using a editor...
Can anyone help me figure out the adress for my 'idLinkURL' input
box???????????? ?????????
Christopher Brandsdal
Here is a cut from my ace.htc:
My problem is marked with:
XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXX
code i have problem with
XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXX
<!-- Link box -->
<script language=javasc ript>
var oSelStore;
var sTypeStore;
var oElStore;
var isLayerActive;
function DisplayLinkBox( )
{
PopupHide()
linkbox.style.d isplay='block';
setPosition()
var sURL;
var oSel = document.select ion.createRange ()
var sType = document.select ion.type
oSelStore = oSel
sTypeStore = sType
if (oSel.parentEle ment)//If text is selected on a layer
{
oEl = GetElement(oSel .parentElement( ),"DIV")//!
oElStore = oEl;//Store the active layer, so we can activate it after
editing links
isLayerActive=t rue;
}
else//If control is selected
{
isLayerActive=f alse;
}
/*************** *************** *************** *************** ***************
**/
/* idLinkImage & idLinkImageBord er
/*************** *************** *************** *************** ***************
**/
//Is the selection image or not ?
if (oSel.parentEle ment)//If not an image (such as text)
{
oEl = GetElement(oSel .parentElement( ),"A")//Get A element if any
idLinkImage.sty le.display = "none";//do not display Image features on the
Link Dialog
idLinkImage1.st yle.display = "none";//do not display Image features on the
Link Dialog
}
else //If a control
{
oEl = GetElement(oSel .item(0),"A")//Get A element if any
if ((oSel.item) && (oSel.item(0).t agName=="IMG")) //If an image
{
idLinkImage.sty le.display = "block"; //display Image features on the Link
Dialog
idLinkImage1.st yle.display = "block"; //display Image features on the
Link Dialog
idLinkImageBord er.value = oSel.item(0).bo rder; //get image border
}
}
/*************** *************** *************** *************** ***************
**/
/* idLinkTarget & idLinkType & idLinkURL
/*************** *************** *************** *************** ***************
**/
//Is there an A element ?
if (oEl)//If Yes
{
btnLinkAction.v alue = "Update"
sURL = oEl.href //get image url
idLinkTarget.va lue = oEl.target;//get image target
if(sURL.indexOf (":")!=-1)
{
switch(sURL.spl it(":")[0])
{
case "http":
idLinkType.valu e = "http://";
idLinkURL.value = sURL.substr(7);
break;
case "https":
idLinkType.valu e = "https://";
idLinkURL.value = sURL.substr(8);
break;
case "mailto":
idLinkType.valu e = "mailto:";
idLinkURL.value = sURL.split(":")[1];
break;
case "ftp":
idLinkType.valu e = "ftp://";
idLinkURL.value = sURL.substr(6);
break;
case "news":
idLinkType.valu e = "news:";
idLinkURL.value = sURL.split(":")[1];
break;
}
}
else
{
idLinkType.valu e = "";
idLinkURL.value = sURL;
}
}
else //If No A element
{
btnLinkAction.v alue = "Insert";
idLinkTarget.va lue = ""
idLinkType.valu e = ""
idLinkURL.value = ""
idLinkImageBord er.value = 0
}
idLinkURL.focus ();//tambahan
}
function CreateHyperlink ()
{
//idContent.focus ()
PopupHide()//Hide Link Dialog
//Get URL typed by user
var inpURL = idLinkURL.value
var inpURLType = idLinkType.valu e
var sURL = inpURLType + inpURL
//Use the previous active selection
var oSel = oSelStore;// document.select ion.createRange ()
var sType = sTypeStore;// document.select ion.type
/*************** *************** *************** *************** ***********/
/* idLinkImageBord er
/*************** *************** *************** *************** ***********/
if ((oSel.item) && (oSel.item(0).t agName=="IMG")) //If image is selected
{
oSel.item(0).wi dth = oSel.item(0).of fsetWidth //kasih attribute width
oSel.item(0).he ight = oSel.item(0).of fsetHeight //kasih attribute height
oSel.item(0).bo rder = idLinkImageBord er.value
}
if(inpURL!="")//If there is URL typed by user
{
if (oSel.parentEle ment) //If text selection
{
if(btnLinkActio n.value == "Insert")
{
if(oSel.text!=" ")
{
//noop
}
else
{
var oSelTmp = oSel.duplicate( )
oSel.text = sURL //displayed text = sURL
oSel.setEndPoin t("StartToStart ",oSelTmp)
oSel.select()
sType="Text"
}
}
if(btnLinkActio n.value == "Update") //pasti ada A element
{
if(oSel.text!=" ")
{
//noop
//oEl = GetElement(oSel .parentElement( ),"A")
//oEl.innerText = sURL
}
else
{
//noop
//oEl = GetElement(oSel .parentElement( ),"A")
//oEl.innerText = sURL
}
}
}
/*************** *************** *************** *************** ***********/
/* idLinkType & idLinkURL (sURL)
/*************** *************** *************** *************** ***********/
oSel.execComman d("CreateLink", false,sURL)
//After A element created, then add the Target
//oSel = document.select ion.createRange ()
if (oSel.parentEle ment)
{
oEl = GetElement(oSel .parentElement( ),"A")
}
else
{
oEl = GetElement(oSel .item(0),"A")
}
if(oEl)
{
if(idLinkTarget .value=="")
{
oEl.removeAttri bute("target",0 )
}
else
{
oEl.target = idLinkTarget.va lue;
}
}
idContent.focus ()
oSel.select()//tambahan
}
//Activate layer again
if(isLayerActiv e)oElStore.setA ctive();
}
</script>
<SCRIPT ID=clientEventH andlersJS LANGUAGE="javas cript">
function InsertBransje(s Field)
{
var ie4 = (document.all && !document.getEl ementById);
var ie5 = (document.all && document.getEle mentById);
var ns6 = (!document.all && document.getEle mentById);
if(ie4 || ie5)
window.open("se lectLink.asp?fl d=" + sField ,
"SelectImage"," scrollbars=Yes, width=506,heigh t=480", true);
else
window.open("se lectLink.asp?fl d=" + sField ,
"SelectImage"," scrollbars=Yes, width=506,heigh t=510", true);
return false;
}
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL , '" + id + "',
'scrollbars=Yes ,width=506,heig ht=480');");
}
</script>
<div id="linkbox" style="position :absolute;displ ay:none">
<table border="0" cellpadding="0" cellspacing="0" style="table-layout:
fixed" bgcolor=Gainsbo ro ID="Table1">
<col width=310><col width=13>
<tr>
<td>
<div class="bar" style="padding-left: 5px;">
<font size=2 face=tahoma color=white><b> Sett inn/endre link</b></font>
</div>
</td>
<td style="cursor:h and"
onclick="linkbo x.style.display ='none';if(isLa yerActive)oElSt ore.setActive() ;
">
<div class="bar">
<font size=2 face=tahoma color=white><b> X</b></font>
</div>
</td>
</tr>
<tr>
<td colspan=2 style="border-left: #336699 1px solid;border-right: #336699
1px solid;border-bottom: #336699 1px solid;">
<br>
<table cellpadding="0" width=310 cellspacing="3" align=center
ID="Table2">
<col width=135><col width=175>
<tr>
XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXX
<td class=normalSma ll colspan=2><stro ng><A HREF="#"
LANGUAGE="javas cript" onclick="Insert Bransje('idLink URL');">add a link from
another page!!!</a></strong></td>
XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXX
</tr>
<tr>
<td class=normalSma ll>
<select id="idLinkType " NAME="idLinkTyp e" class=control01
style="width:13 0">
<option value="" selected></option>
<option value="http://" selected>http://</option>
<option value="https://">https://</option>
<option value="mailto:" >mailto:</option>
<option value="ftp://">ftp://</option>
<option value="news:">n ews:</option>
</select>
</td>
<td class=normalSma ll>
XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXX
<input type=text size=10 id="idLinkURL" value="" class=control01
NAME="idLinkURL " style="width:17 5">
XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXX
</td>
</tr>
<tr>
<td class=normalSma ll>Mål:</td>
<td class=normalSma ll>
<select id="idLinkTarge t" NAME="idLinkTar get" class=control01
style="width:17 5">
<option value="" selected>ingen</option>
<option value="_self" selected>i samme rute</option>
<option value="_top" selected>topp</option>
<option value="_blank"> blank</option>
<option value="_parent" >foreldre</option>
</select>
</td>
</tr>
<tr>
<td class=normalSma ll><div id="idLinkImage " style="display: none"><font
class=normalSma ll>Bilderamme:</font></div></td>
<td class=normalSma ll>
<div id="idLinkImage 1" style="display: none">
<select id="idLinkImage Border" NAME="idLinkIma geBorder" class=control01
style="width:17 5">
<option value="0" selected>0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</div>
</td>
</tr>
<tr><td colspan=2 height=6><img
src="images/1px_transparent .gif"></td></tr>
<tr>
<td colspan=2 align=center class=normalSma ll>
<input type="button" value="Avbryt"
onclick="linkbo x.style.display ='none';if(isLa yerActive)oElSt ore.setActive() ;
" ID="Button1" NAME="Button1" class=control01 >
<input type="button" id="btnLinkActi on" name="btnLinkAc tion"
value="Sett inn" onclick="Create Hyperlink();lin kbox.style.disp lay='none'"
class=control01 >
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!-- /Link box -->