FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Need Help AJAX using WYSWYG Script.





Philip
i have a php page that using WYSWYG

Code:

<html>
<script language="javascript" type="text/javascript" src="scripts/wysiwyg.js"></script>
<body>
<textarea id="textarea1" name="test1" style="height: 170px; width: 500px;"></textarea>
                                 </div>
                                 <div align="right">
                                   <script language="javascript1.2">
                                   generate_wysiwyg('textarea1');
                                 </script>
</body>            
</html>



i am using ajax for open this page, but it seem the WYSWYG toolbar doesn't previewed so it didn;t work but when i was using with out ajax to call this page, i mean the ussually way, the WYSWYG toolbar is showed up.

Is seem i need to refresh something up, can someone suggest me what need i to do ?
oh and i am using OpenWYSIWYG for editor.

thanks,
JayBee
When you load this page with AJAX.
Is the relative path to "scripts/wysiwyg.js" the same for loaded and loading page?
Code:

[www_root]
 |
 +--[somestuff]
 |     |
 |     +---[scripts]
 |     |      |
 |     |      +---wysiwyg.js
 |     |
 |     +---page_with_wysiwig.html
 |
 +---index.html


if you have the directory structure like this
and the source of "page_with_wysiwig.html" is source you post
it couldn't work when you loads this page from index.hml

soltion:
in file "page_with_wysiwig.html"
you must have this line insted
Code:
<script language="javascript" type="text/javascript" src="somestuff/scripts/wysiwyg.js"></script>

and there could be other problems with paths, so be careful
Philip
i know2x , there s nothing wrong with my javascript files path,
i am just using AJAX for opening this page that having WYSIWG editor.
and it seem need a refresh whole page for showing WYSIWYG menu bar,
it is because the call function WYSIWYG don;t work, i wonder how to call the function.. i have try to textarea onClick, but it seem not so gud think for need a user to click the text area first before using the WYSIWYG editor..

Code:
<textarea id="txtupdateisi" name="txtupdateisi" style="height: 170px; width: 500px;" onClick="generate_wysiwyg('txtupdateisi');" ><? echo $isi; ?></textarea>
<script language="javascript">
generate_wysiwyg('txtupdateisi'); <-- that function dont started
</script>



that i meaned a bad idea and not gud think for user to click this textarea first.
Code:
<textarea id="txtupdateisi" name="txtupdateisi" style="height: 170px; width: 500px;" onClick="generate_wysiwyg('txtupdateisi');" ><? echo $isi; ? onclick="generate_wysiwyg('txtupdateisi');"></textarea>


any suggestion for me ?
-Philip
JayBee
Oh,
XMLHttpRequest has blocking mode and it wait until the page is loaded, then you want to call generate_wysiwyg('txtupdateisi')

something like this, where id is id of element, where you want to load the wysiwyg and url is url of page with wysiwyg
Code:
function load_wysiwyg(id,url) {
    el = document.getElementById(id);
    el.innerHTML = "<img src=\"wait.gif\" alt=\"wait\">";

    if (document.getElementById) {
        var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
    }
    if (x) {
        x.onreadystatechange = function() {
            if (x.readyState == 4 && x.status == 200) {
                el = document.getElementById(id);
                el.innerHTML = x.responseText;
                generate_wysiwyg('txtupdateisi');
           }
        }
    }

    x.open("GET", url, true);
    x.send(null);
}


I don't now, if it will wark. I don't test this code Embarassed for this purpose.

Few months ago, I want to persuade FCKeditor to do something extra, but there were so many bugs and confusing things, that it worked only partialy. Try to ask openWYSIWYG forum, how to do it better, they will answer you.
Philip
ok i get it after with fill div with a content, we call a javascript for refresh that WYSIWYG, am i right ? Smile
Related topics
Navigation Script (javascript) Help Please!
How to code Minimise button using action script in Flash?
Help with SimplePHPblog
Help with upload form script! [RESOLVED]
php script help!
Guestbook Help
Need Help, how to transfer to files to server using $_GET
php..free account help
Sending simple emails using PERL - Help required
Ajax or JS - need help ASAP
Help in detect terminate script
[SCRIPT] Recopilación de recusos Ajax listos para usar
Rgistry keys modification using VB Script
problem with AJAX display
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.