View Single Post
ישן 22-07-08, 16:17   # 1
Ron | CSite.co.il
חבר על
 
מיני פרופיל
תאריך הצטרפות: Jun 2007
גיל: 33
הודעות: 980

Ron | CSite.co.il לא מחובר  

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); 
}
יום טוב.
  Reply With Quote