Show about the display of double quotes and single quotes in the input box
Foreground display Solution:
method One:
single quotes <input type= "text" value= "'" >
double quotes <input type= "text" value= ' "' >
Method II:
single quotes <input type= "text" value= "'" >
double quotes <input type= "text" value= "" ">
from the background to read the data foreground display solution:
We should add the conversion
when we read the value from the database to the foreground display
JavaScript version:
<% @Language = "JavaScript"%>
<%
function Foramtvalue (OSTR)
{
switch (typeof (OSTR))
{
case "Date":
//Direct ToString () conversion, you can add rich display mode
sStr = (new Date (OSTR)). ToString ();
break;
Default:
sStr = String (OSTR);
}
sStr = sstr.replace (/\ "/g," ""); The issue of double quotes in the input box
sStr = sstr.replace (/\ '/g, ""); Display single quotes in an input box
return sStr;
}
%>
<%
//Test
var str = "\" Gray beans baby. NET (magical season) \ "";
var str = new Date ();
%>
<br>
<input type= "text" value= "<%=str%>" style= "width:200px" >[is not displayed properly]<br>
<input type= "text" value= "<%=foramtvalue (str)%>" style= "width:200px" >[normal display]<br>
VBScript version:
<% @Language = "VBScript"%>
<%
function Foramtvalue (OSTR)
Select Case VarType (OSTR)
case "Vbdate"
' direct ToString () conversion, you can add rich display mode
sStr = CDate (ostr)
Case Else
sStr = CStr (ostr)
End Select
sStr = Replace (SStr, "" "," ")" "The box shows the double quotation mark problem
sStr = Replace (sStr, "'", "") "the input box displays the single quotation mark question
Foramtvalue = SStr
End Function
%>
<%
' Test
Dim str
str = "" "Grey bean Baby. NET (Magical season)" ""
%>
<br>
<input type= "text" value= "<%=str%>" style= "width:200px" >[is not displayed properly]<br>
<input type= "text" value= "<%=foramtvalue (str)%>" style= "width:200px" >[normal display]<br>