Click to See Complete Forum and Search --> : IFRAME Problems again


Zor
12-28-2002, 05:41 PM
Ok, i try to explain to problem.

I have an IFRAME named "iEdit" and I have a div-field named="palette" which is hidden first. It is generated by PHP and shows a palette. After clicking on the TextColorButton I make the div-field visible.

IFRAME:
<iframe name="iEdit" style="width:500px; height:300px"></iframe>

div-Field:
<div z-Index=5 id="palette" style="position:absolute; visibility:hidden; width:0px; height:0px; top: 20px; left: 160px;">
<table border="0" cellpadding="5" cellspacing="5" bgcolor="#D6D3CE">
<tr>
<?php
$hex = array(0,1,2,3,4,5,6,7,8,9,"A","B","C","D","E","F");
$i=0;
$j=0;
$k=0;
foreach ($hex as $val1)
foreach ($hex as $val2)
foreach ($hex as $val3)
if (eregi("[00|44|88|BB|FF]", $val1))
if (eregi("[00|44|88|BB|FF]", $val2))
if (eregi("[00|44|88|BB|FF]", $val3)) {
if ($i%8==0)
echo "</tr><tr>";
$color = "$val1$val1$val2$val2$val3$val3";
echo "<td bgcolor=\"$color\" style=\"width:10; height:10\" onclick=\"doTextColor('$color')\"></td>";
$i++;
}
?>
</tr>
</table>
</div>

Function to make it visible:
function ShowColorPalette() {
document.all.palette.style.visibility = 'visible';
}


I see my palette. When I click on a Color-Button the following function will be called:

function doTextColor(farbe) {
iEdit.document.execCommand('ForeColor', false, 'farbe');
}

Could it be that my IFRAME-Field has no selection after popping up the palette-div-field? How can I fix it? Please help me it confuses me. There has to be a solution...

Oh and by the way, the value farbe does exist in doTextColor. I already tested it with an alert-box. So how da ....... can i change the Text- or Backgroundcolor with the help of this cool palette-window. I dont want to make a prompt-field, because the editor has to be as easy as it can be...

swon
12-28-2002, 08:07 PM
that's because you have the onClick event on the td of the div, so the iEdit has no focus or selection. you should use an winopen or a showModelessDialog for that instead a div (I have created an Wysiwyg editor and used only at the beginning divs, exactly having this problems).

Zor
12-29-2002, 06:51 AM
Could you give me an example for a showModelessDialog? And how can I show the Dialog that the actions have to take part in the main windows?

swon
12-29-2002, 04:37 PM
Hi Zor this code for an example of a ModalDialog:

<script language=javascript>
function modalD(){
strPage = "insertcolor.html"; //which site is in the modal
strAttr= "status:no;dialogWidth:420px;dialogHeight:230px;";
html = showModalDialog(strPage, mywin, strAttr);
}
</script>
<a href="#" onClick="modalD()">show ModalDialog</a>

Zor
12-29-2002, 07:55 PM
Your code does not work!!! My Browser does not know ShowModalDialog - is it a function from Microsoft C???

swon
12-29-2002, 08:45 PM
Oh :rolleyes: , yes, sorry did not know that you want it crossbrowser f., instead of the modal use the window.open, that works too.