הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   ajax|ירידת שורה בתיבת textarea (https://hosts.co.il/forums/showthread.php?t=65458)

Ron | CSite.co.il 22-07-08 16:17

ajax|ירידת שורה בתיבת textarea
 
שלום לכולם,
יש לי בעיה ממש מוזרה עם textarea.
אני מנסה לעדכן נתונים במסד עם תיבת טקסט ללא רענון.
הכל מתעדכן טוב רק שכל תווי הירידת שורה פשוט נעלמים (תגי ה \n).

אגב בהתחלה חשבתי שהבעיה היא פה:
HTML קוד:

                        // evaluate javascript
                        scriptTag='(<script.*?>)((\n|\r|.)*?)(<\/script>)';
                        if (scripts=resultsuser.match(scriptTag))
                        {
                                // remove slashes
                                scripts[2]=scripts[2].replace(/\\/g,"");
                                //run scripts
                                eval(scripts[2]);
                        }

אבל הורדתי את הקטע הזה וזה עדיין נשאר אותו הדבר.

קוד html:
HTML קוד:

<form name='Login'>
        <textarea cols="91" rows="15" id="ContentMessage"><tag:Content messages admins.Content /></textarea>
        <br />
        <input type='button' class="button" value="עדכן"
        onclick='AjaxUpdateDiv("MessageAdmins","ajax/ajax_index.php","?ContentMessage="+                                                                          document.getElementById("ContentMessage").value);' />
       
        <input type="button" class="button" value="בטל"
        onclick='AjaxUpdateDiv("MessageAdmins","ajax/ajax_index.php","?ajax=cancel")' />
       
</form>

קוד js :
HTML קוד:

//Browser Support Code
function AjaxUpdateDiv(DivUpdate,PageOpen,get)
{
        var ajaxRequest;  // The variable that makes Ajax possible!
        try
        {
                // Opera 8.0+, Firefox, Safari
                ajaxRequest = new XMLHttpRequest();
        }
        catch (e)
        {
                // Internet Explorer Browsers
                try
                {
                        ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch (e)
                {
                        try
                        {
                                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                        }
                        catch (e)
                        {
                                // Something went wrong
                                alert("Your browser broke!");
                                return false;
                        }
                }
        }
       
        // Create a function that will receive data sent from the server
        ajaxRequest.onreadystatechange = function()
        {
                if(ajaxRequest.readyState == 4)
                {
                        var ajaxDisplay = document.getElementById(DivUpdate);
                        ajaxDisplay.innerHTML = ajaxRequest.responseText;
                       
                        resultsuser = ajaxRequest.responseText;
                        // evaluate javascript
                        scriptTag='(<script.*?>)((\n|\r|.)*?)(<\/script>)';
                        if (scripts=resultsuser.match(scriptTag))
                        {
                                // remove slashes
                                scripts[2]=scripts[2].replace(/\\/g,"");
                                //run scripts
                                eval(scripts[2]);
                        }               
                }
        }
       
        ajaxRequest.open("GET",PageOpen + get, true);
        ajaxRequest.send(null);
}

יום טוב.


כל הזמנים הם GMT +2. הזמן כעת הוא 08:52.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ