petervazed
11-17-2004, 08:01 PM
In a php edit page there is a form to write text in a textarea. After submit the text can be seen in the Magazine.
This submit is OK.
But, it is possible to add a picture in the text.
To add the picture a popup window shows up.
In this popupwindow is this script:
<script type="text/javascript">
<!--
function TransferIt(id,align)
{
handle = opener.ret;
if(handle == 'message')
{
opener.insertAtCaret(opener.novica.message,'[PIC='+id+':'+align+']');
//opener.novica.message.value = opener.novica.message.value + '[PIC='+id+':'+align+']';
}
if(handle == 'preview')
opener.insertAtCaret(opener.novica.preview,'[PIC='+id+':'+align+']');
// opener.novica.preview.value = opener.novica.preview.value + '[PIC='+id+':'+align+']';
}
function CloseIt()
{
window.close();
}
-->
</script>
In the layout of this page you can click a picture with position left center or right.
This is the code:
<td width="130">
<a href="javascript:TransferIt(<?=$ar[id];?>,'left');"><?=_LEFT;?></a> .
<a href="javascript:TransferIt(<?=$ar[id];?>,'center');"><?=_CENTER;?></a> .
<a href="javascript:TransferIt(<?=$ar[id];?>,'right');"><?=_RIGHT;?></a>
</td>
Then in the editwindow, where the text is, the code of the picture has to go on atCaret.
Using Internet Exporer no problem, it works.
But using Netscape: no picture code in the text.
And using OnClick did not work.
How have i to change the code to make it work in Netscape?
:cool:
This submit is OK.
But, it is possible to add a picture in the text.
To add the picture a popup window shows up.
In this popupwindow is this script:
<script type="text/javascript">
<!--
function TransferIt(id,align)
{
handle = opener.ret;
if(handle == 'message')
{
opener.insertAtCaret(opener.novica.message,'[PIC='+id+':'+align+']');
//opener.novica.message.value = opener.novica.message.value + '[PIC='+id+':'+align+']';
}
if(handle == 'preview')
opener.insertAtCaret(opener.novica.preview,'[PIC='+id+':'+align+']');
// opener.novica.preview.value = opener.novica.preview.value + '[PIC='+id+':'+align+']';
}
function CloseIt()
{
window.close();
}
-->
</script>
In the layout of this page you can click a picture with position left center or right.
This is the code:
<td width="130">
<a href="javascript:TransferIt(<?=$ar[id];?>,'left');"><?=_LEFT;?></a> .
<a href="javascript:TransferIt(<?=$ar[id];?>,'center');"><?=_CENTER;?></a> .
<a href="javascript:TransferIt(<?=$ar[id];?>,'right');"><?=_RIGHT;?></a>
</td>
Then in the editwindow, where the text is, the code of the picture has to go on atCaret.
Using Internet Exporer no problem, it works.
But using Netscape: no picture code in the text.
And using OnClick did not work.
How have i to change the code to make it work in Netscape?
:cool: