Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

open wysiwyg sa ajax-om

[es] :: Javascript i AJAX :: open wysiwyg sa ajax-om

[ Pregleda: 1056 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

DankoH
Danijel Skok

Član broj: 55253
Poruke: 80
*.adsl.net.t-com.hr.



+1 Profil

icon open wysiwyg sa ajax-om03.08.2010. u 11:54 - pre 167 meseci
Bok ljudi.

Korisim openWYSIWYG za unos novosti na stranicu. Radi kako treba kada na pocetku normalno loadam editor. Znaci kad je sve u .php filu i kad taj file pozovem. Sve je ok.

Sad bi ja stavio tabove. Da je u jednom tabu editor a u drugom tabu da su novosti aktivne i jos jedan sa neaktivnim novostima. Sve to kuzim, tabovi su ok, i ajax odraduje posao i vraca bowseru ono sto trebam. Problem nastaje kad hoću ponovo editr ali preko ajax requesta. Ovako to izgleda


Code:

.....
....
<script type="text/javascript">
function getXMLHTTP()
{ //fuction to return the xml http object
        var xmlhttp=false;    
        try{
            xmlhttp=new XMLHttpRequest();
        }
        catch(e)    {        
            try{            
                xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e){
                try{
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch(e1){
                    xmlhttp=false;
                }
            }
        }
    return xmlhttp;
}

function ajaxreq(strURL, div)
{
    var req = getXMLHTTP(); // fuction to get xmlhttp object
    if (req)
    {
        req.onreadystatechange = function()
                                    {
                                        if (req.readyState == 4)
                                        { //data is retrieved from server
                                            if (req.status == 200)
                                            { // which reprents ok status
                                                document.getElementById(div).innerHTML=req.responseText;
WYSIWYG.attach('textarea1', full); 
WYSIWYG.attach('textarea2', full);
                                            }
                                            else
                                            {
                                                alert("There was a problem while using XMLHTTP:\n");
                                            }
                                        }
                                    }
        req.open("GET", strURL, true); //open url using get method
        req.send(null);
    }

}
</script>
<script type="text/javascript" src="scripts/wysiwyg.js"></script>
<script type="text/javascript" src="scripts/wysiwyg-settings.js"></script>
<script type="text/javascript">
        WYSIWYG.attach('textarea1', full); 
        WYSIWYG.attach('textarea2', full);
</script>


....
...

<div id="news_content" style="">

Short news:
<textarea id="textarea1" name="text1" style="margin-left: 20px; width:95%; height:200px;margin-bottom:20px;" >
<?=$content?>
</textarea>
<br>
<br>
News detail:
<textarea id="textarea2" name="text2"  style="margin-left: 20px; width:95%; height:600px;margin-bottom:20px;"  >
<?=$content_detail?>
</textarea>

</div>



to radi. Ne radi kad pozovem ovako






Code:




onclick="ajaxreq('get_editor.php?news=45', 'news_content');"





//getEditor.php
.....
.....

Short news:
<textarea id="textarea1" name="text1" style="margin-left: 20px; width:95%; height:200px;margin-bottom:20px;" >
<?=$content?>
</textarea>
<br>
<br>
News detail:
<textarea id="textarea2" name="text2"  style="margin-left: 20px; width:95%; height:600px;margin-bottom:20px;"  >
<?=$content_detail?>
</textarea>






Odradi mi sve( prikaže textarea, popuni ih sa podacima i sve se čini ok, samo nemam WYSIWYG editora.

Nešto mi fali a ne znam šta.
 
Odgovor na temu

Miroslav Ćurčić
ex mVeliki
Novi Sad

Član broj: 19034
Poruke: 1118
*.adsl.eunet.rs.



+19 Profil

icon Re: open wysiwyg sa ajax-om03.08.2010. u 20:59 - pre 167 meseci
U jednom starijem projektu koristio sam "_generate" funkciju.

Kad ajaxom dovučem novu textareu pozivao sam WYSIWYG._generate("IdOdTexteree"); a prethodno je učitana njegova glavna biblioteka i css.
"The quieter you become, the more you are able to hear."
Blog | PowerCMS
 
Odgovor na temu

[es] :: Javascript i AJAX :: open wysiwyg sa ajax-om

[ Pregleda: 1056 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.