469,336 Members | 5,592 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

Problems with WYSIWYG.

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.idLinkURL.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:

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX
code i have problem with
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX


<!-- Link box -->
<script language=javascript>
var oSelStore;
var sTypeStore;

var oElStore;
var isLayerActive;

function DisplayLinkBox()
{
PopupHide()
linkbox.style.display='block';
setPosition()
var sURL;
var oSel = document.selection.createRange()
var sType = document.selection.type

oSelStore = oSel
sTypeStore = sType

if (oSel.parentElement)//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=true;
}
else//If control is selected
{
isLayerActive=false;
}
/************************************************** *************************
**/
/* idLinkImage & idLinkImageBorder

/************************************************** *************************
**/
//Is the selection image or not ?
if (oSel.parentElement)//If not an image (such as text)
{
oEl = GetElement(oSel.parentElement(),"A")//Get A element if any
idLinkImage.style.display = "none";//do not display Image features on the
Link Dialog
idLinkImage1.style.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).tagName=="IMG")) //If an image
{
idLinkImage.style.display = "block"; //display Image features on the Link
Dialog
idLinkImage1.style.display = "block"; //display Image features on the
Link Dialog
idLinkImageBorder.value = oSel.item(0).border; //get image border
}
}
/************************************************** *************************
**/
/* idLinkTarget & idLinkType & idLinkURL

/************************************************** *************************
**/
//Is there an A element ?
if (oEl)//If Yes
{
btnLinkAction.value = "Update"
sURL = oEl.href //get image url
idLinkTarget.value = oEl.target;//get image target
if(sURL.indexOf(":")!=-1)
{
switch(sURL.split(":")[0])
{
case "http":
idLinkType.value = "http://";
idLinkURL.value = sURL.substr(7);
break;
case "https":
idLinkType.value = "https://";
idLinkURL.value = sURL.substr(8);
break;
case "mailto":
idLinkType.value = "mailto:";
idLinkURL.value = sURL.split(":")[1];
break;
case "ftp":
idLinkType.value = "ftp://";
idLinkURL.value = sURL.substr(6);
break;
case "news":
idLinkType.value = "news:";
idLinkURL.value = sURL.split(":")[1];
break;
}
}
else
{
idLinkType.value = "";
idLinkURL.value = sURL;
}
}
else //If No A element
{
btnLinkAction.value = "Insert";

idLinkTarget.value = ""
idLinkType.value = ""
idLinkURL.value = ""
idLinkImageBorder.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.value
var sURL = inpURLType + inpURL

//Use the previous active selection
var oSel = oSelStore;// document.selection.createRange()
var sType = sTypeStore;// document.selection.type

/************************************************** *********************/
/* idLinkImageBorder
/************************************************** *********************/
if ((oSel.item) && (oSel.item(0).tagName=="IMG")) //If image is selected
{
oSel.item(0).width = oSel.item(0).offsetWidth //kasih attribute width
oSel.item(0).height = oSel.item(0).offsetHeight //kasih attribute height
oSel.item(0).border = idLinkImageBorder.value
}

if(inpURL!="")//If there is URL typed by user
{
if (oSel.parentElement) //If text selection
{
if(btnLinkAction.value == "Insert")
{
if(oSel.text!="")
{
//noop
}
else
{
var oSelTmp = oSel.duplicate()
oSel.text = sURL //displayed text = sURL
oSel.setEndPoint("StartToStart",oSelTmp)
oSel.select()
sType="Text"
}
}
if(btnLinkAction.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.execCommand("CreateLink",false,sURL)

//After A element created, then add the Target
//oSel = document.selection.createRange()
if (oSel.parentElement)
{
oEl = GetElement(oSel.parentElement(),"A")
}
else
{
oEl = GetElement(oSel.item(0),"A")
}
if(oEl)
{
if(idLinkTarget.value=="")
{
oEl.removeAttribute("target",0)
}
else
{
oEl.target = idLinkTarget.value;
}
}
idContent.focus()
oSel.select()//tambahan
}

//Activate layer again
if(isLayerActive)oElStore.setActive();
}
</script>
<SCRIPT ID=clientEventHandlersJS LANGUAGE="javascript">

function InsertBransje(sField)
{
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);

if(ie4 || ie5)
window.open("selectLink.asp?fld=" + sField ,
"SelectImage","scrollbars=Yes,width=506,height=480 ", true);
else
window.open("selectLink.asp?fld=" + sField ,
"SelectImage","scrollbars=Yes,width=506,height=510 ", true);
return false;
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "',
'scrollbars=Yes,width=506,height=480');");
}

</script>

<div id="linkbox" style="position:absolute;display:none">
<table border="0" cellpadding="0" cellspacing="0" style="table-layout:
fixed" bgcolor=Gainsboro 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:hand"
onclick="linkbox.style.display='none';if(isLayerAc tive)oElStore.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>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX
<td class=normalSmall colspan=2><strong><A HREF="#"
LANGUAGE="javascript" onclick="InsertBransje('idLinkURL');">add a link from
another page!!!</a></strong></td>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX
</tr>
<tr>
<td class=normalSmall>
<select id="idLinkType" NAME="idLinkType" class=control01
style="width:130">
<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:">news:</option>
</select>
</td>
<td class=normalSmall>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX
<input type=text size=10 id="idLinkURL" value="" class=control01
NAME="idLinkURL" style="width:175">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX

</td>
</tr>
<tr>
<td class=normalSmall>Mål:</td>
<td class=normalSmall>
<select id="idLinkTarget" NAME="idLinkTarget" class=control01
style="width:175">
<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=normalSmall><div id="idLinkImage" style="display:none"><font
class=normalSmall>Bilderamme:</font></div></td>
<td class=normalSmall>
<div id="idLinkImage1" style="display:none">
<select id="idLinkImageBorder" NAME="idLinkImageBorder" class=control01
style="width:175">
<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=normalSmall>
<input type="button" value="Avbryt"
onclick="linkbox.style.display='none';if(isLayerAc tive)oElStore.setActive();
" ID="Button1" NAME="Button1" class=control01>
<input type="button" id="btnLinkAction" name="btnLinkAction"
value="Sett inn" onclick="CreateHyperlink();linkbox.style.display=' none'"
class=control01>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!-- /Link box -->

Jul 19 '05 #1
0 1474

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Martin | last post: by
6 posts views Thread by lb | last post: by
19 posts views Thread by Bill Davidson | last post: by
12 posts views Thread by Michael Peters | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.