在textarea中输入内容并显示内容(html等也当字符显示)
<br><font>aaa</font><br><font>aaa</font>以上内容原封不动显示...
<br>
<font>aaa</font>
<br>
<font>aaa</font>
以上内容原封不动显示 展开
<font>aaa</font>
<br>
<font>aaa</font>
以上内容原封不动显示 展开
2个回答
展开全部
注意,请把下面编码中,“& lt;”和“& gt;”中的空格拿掉。一下编码由asp实现要求功丛桥让能,运行结果包括显示编码及显示效果。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Tryit Editor</title>
<style>
.code_input, .result_output
{
border:1px solid #c3c3c3;
width:100%;
height:400px;
background-color:#ffffff;
color:#000000;
}
.result
{
width:100%;
background-color:#e5eecc;
color:#000000;
border:solid #c3c3c3 1px;
margin-left:0px;
height:400px
}
</style>
</head>
<body>
<form style="margin:0px" action="" method="post" target="view">
<table>
<tr>
<td width="500px">
<input style="margin-bottom:5px;font-family:verdana;" name="submit" type="submit" value="提交 >>" />
</td>
<td width="500px" valign="top">
<p class="result_header">结渗局果:</p>
</td>
<tr>
<td>
<textarea class="code_input" name="code" id='code' wrap="logical" orows="21" ocols="42"></textarea>
</td>
<td valign='top'>
<div class='result'>
<%
dim code
code = Request.Form("code")
If code<>"" Then
Response.Write("<h3>消升代码为:</h3>")
dim tempstr
tempstr = replace(code, "<", "& lt;")
tempstr = replace(tempstr, ">", "& gt;")
Response.Write(tempstr)
Response.Write("<h3>运行结果为:</h3>")
Response.Write(code)
End if
%>
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Tryit Editor</title>
<style>
.code_input, .result_output
{
border:1px solid #c3c3c3;
width:100%;
height:400px;
background-color:#ffffff;
color:#000000;
}
.result
{
width:100%;
background-color:#e5eecc;
color:#000000;
border:solid #c3c3c3 1px;
margin-left:0px;
height:400px
}
</style>
</head>
<body>
<form style="margin:0px" action="" method="post" target="view">
<table>
<tr>
<td width="500px">
<input style="margin-bottom:5px;font-family:verdana;" name="submit" type="submit" value="提交 >>" />
</td>
<td width="500px" valign="top">
<p class="result_header">结渗局果:</p>
</td>
<tr>
<td>
<textarea class="code_input" name="code" id='code' wrap="logical" orows="21" ocols="42"></textarea>
</td>
<td valign='top'>
<div class='result'>
<%
dim code
code = Request.Form("code")
If code<>"" Then
Response.Write("<h3>消升代码为:</h3>")
dim tempstr
tempstr = replace(code, "<", "& lt;")
tempstr = replace(tempstr, ">", "& gt;")
Response.Write(tempstr)
Response.Write("<h3>运行结果为:</h3>")
Response.Write(code)
End if
%>
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
展开全部
<textarea id="test"让正></textarea>
<script language="javascript">
var str="<font><b>asdfa</b></font>坦谈悔";
txt=document.createElement('DIV');
txt.innerHTML=str;
test.appendChild(txt);
window.onbeforeunload=function oLoad(){document.location.reload()}
</script>
也是侍陪网上找的 仅供参考
<script language="javascript">
var str="<font><b>asdfa</b></font>坦谈悔";
txt=document.createElement('DIV');
txt.innerHTML=str;
test.appendChild(txt);
window.onbeforeunload=function oLoad(){document.location.reload()}
</script>
也是侍陪网上找的 仅供参考
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询