English 中文(简体)
PHP: Ajax 忽略了案文中的条块。
原标题:PHP: Ajax ignores line foldings in the text

我不理解,为什么我的阿富汗复兴共和与民主军的描述忽视了所有线性交。 我对文本进行了第一种文字处理,然后将浮标放到纽州。 我的日本宇宙航空研究开发机构认识到:

// creating ajax object
// ====================

function createRequestObject(){
try { return new XMLHttpRequest() }
catch(e)
{
try { return new ActiveXObject( Msxml2.XMLHTTP ) }
catch(e)
{
try { return new ActiveXObject( Microsoft.XMLHTTP ) }
catch(e) { return null; }
}
}
}

// message options (save, cancel)
// ==============================

function form1(text){
var http = createRequestObject();
if(http){
http.open("GET", "my_script.php?text=" + text);
http.onreadystatechange = function (){
if(http.readyState == 4){
alert("Ok!");
}
}
http.send(null);
} else {
document.location = "my_script.php?text=" + text;
}
}

<><><>>>>>

<p align="justify" style="margin-right:10; margin-left:10;">

<table style="margin-right:10; margin-left:10;" align="center" border="0" cellpadding="0" cellspacing="0" width="680">
<TBODY>
<form name="fgform">
<tr>
<td width="680" height="100" colspan="2"><p><textarea id="edit_text1" name="edit_text" rows="3" style="width: 680; height: 100;"></textarea></p></td>
</tr>

<tr>
<td width="340"><p><input type="button" id="saveB" value="Save Text" style="color:rgb(0,204,0); background-color:white; border-width:1; border-color:rgb(225,218,202); border-style:solid; width:100;" onclick="form1(document.getElementById( edit_text1 ).value);"></p></td>
<td width="340"><p align="right">&nbsp;</p></td>
</tr>
</form>
</TBODY>
</table>
问题回答

由我手稿.php在显示文本内容之前,先发挥Nl2br()的作用。

并且,你应当利用逃脱功能,以提供这样的数据:

document.position = “my_script.php?text=” + 越狱(text);

我找到了答案:

这里是一种特殊职能,可取代具有特殊性质的所有条块。

// multiply replacing function
// ===========================

function repl(text,replaceData1,replaceData2){
if(text.indexOf(replaceData1)==-1){
return text;
}
return text.split(replaceData1).join(replaceData2);

然后,在送交我的稿件之前,取代文本里的所有线夹。 php在点击发送纽顿时,使用上述功能:

onclick="form1(repl(document.getElementById( edit_text1 ).value, 
 , | ));




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签