[求助]textarea中执行html代码问题
以下代码中红色部分单独用时在框里出现加粗的“测试一把”,但用在这段代码中就不显示,也即没执行。请高手指点!说明:红色部分是在textarea中执行html代码。
<%@ Language = VBScript %>
<%
action=request("action")
if action="ok" then
'==================================================title标题 gsname接收人 dgname点歌人 content温馨小语
' 参数设置开始,请修改相应参数
smtpserver = "smtp. '发送邮件所使用的SMTP服务器,例如smtp.,请修改
smtpuser = "thbwn" '与SMTP服务器对应的邮箱用户名,请修改
smtppwd = "14789744" '与SMTP服务器对应的邮箱密码,请修改
smtpemail = "thbwn@ 'SMTP服务器发信邮箱,请修改
'myemail="thbwn@ '用来接收邮件的邮箱,请修改,可以与SMTP服务器发信邮箱不同
' 参数设置结束
'==================================================
myemail=trim(Request("myemail"))
sendname = trim(Request("name")) '发件人名字
email = trim(Request("email")) '发件人邮箱
title = trim(Request("title"))
content = trim(Request("content"))
content1 = trim(Request("content1"))
content2 = trim(Request("content2"))
ishtml = trim(Request("ishtml"))
if sendname="" or email="" or title="" or content="" or myemail="" then
response.write "邮件发送失败,请填写每一项!<a href=javascript:history.go(-1)>返回上一页</a>"
response.end
end if
if ishtml = "2" then
mailbody=mailbody &"<style>A:visited { TEXT-DECORATION: none }"
mailbody=mailbody &"A:active { TEXT-DECORATION: none }"
mailbody=mailbody &"A:hover { TEXT-DECORATION: underline }"
mailbody=mailbody &"A:link { text-decoration: none;}"
mailbody=mailbody &"BODY { FONT-FAMILY: 宋体; FONT-SIZE: 9pt;}"
mailbody=mailbody &"TD { FONT-FAMILY: 宋体; FONT-SIZE: 9pt }</style>"
mailbody=mailbody &"<TABLE border=0 width='95%' align=center><TBODY><TR><TD>"
mailbody=mailbody &"您好!这是您的好友<font color=""#FF0000""</font>["&sendname&"]</font>给您发的邮件,以下是具体内容:<br>"
mailbody=mailbody &"*************************************************************************************"
mailbody=mailbody &"<br><br>"&content&"<br><br><br><br><br><br>"
mailbody=mailbody &"*************************************************************************************"
mailbody=mailbody &"<br>此邮件由<a target=""blank"" href=""http://www. color=""#0000FF""</font>“服务之窗”(http://thbwn.)</a></font>在线邮件系统发送,请勿直接回复此邮件!<br>"
mailbody=mailbody &"该邮件的发件人为["&sendname&"],发件人邮箱为["&email&"]!<br>"
mailbody=mailbody &"如果需要回复,<font color=""#FF0000""</font>请发邮件至["&email&"]</font>,切记!本站对所发内容不负任何法律责任!<br>"
mailbody=mailbody &"</TD></TR></TBODY></TABLE>"
elseif ishtml = "1" then
mailbody=mailbody &""&content1&""
mailbody=mailbody &""&content&""
mailbody=mailbody &""&content2&""
end if
if sendname <> "" and email <> "" then
set jmail= server.CreateObject ("jmail.message")
jmail.Silent = true
jmail.Charset = "gb2312"
if ishtml = "2" then
JMail.ContentType = "text/html"
elseif ishtml = "1" then
JMail.ContentType = "text/plain"
end if
jmail.From = smtpemail
jmail.FromName = sendname
jmail.ReplyTo = email
jmail.Subject = title
jmail.AddRecipient myemail
jmail.Body = mailbody
jmail.MailServerUserName = smtpuser
jmail.MailServerPassWord = smtppwd
isgo = jmail.Send(smtpserver)
if isgo then
msg="邮件发送成功!谢谢您的支持。"
else
msg = "邮件发送失败!请检查您的参数设置是否正确!"
end if
jmail.Close
set jmail = nothing
end if
end if
%>
<html>
<head>
<style>
BODY
{SCROLLBAR-ARROW-dCOLOR:#ff0000; SCROLLBAR-BASE-COLOR:#b8c8d8;background:#CAD7F7; FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif, 宋体}
A {text-decoration: none; font-size: 9pt;}
A:visited {TEXT-DECORATION: none; color: #555555;}
A:active {TEXT-DECORATION: none; color: #000000;}
A:hover {COLOR: #0099cc; TEXT-DECORATION: underline; TEXT-DECORATION:none; position:relative; left: 1px; top: 1px}
A:link {text-decoration: none; color: #0000A0;}
.t{LINE-HEIGHT: 1.4;}
P {FONT-SIZE:9pt; LINE-HEIGHT: 12pt;}
TD{font-size: 9pt; LINE-HEIGHT: 12pt;}
div {font-size: 9pt;}
input {font-family: "Tahoma", "Verdana"; font-size: 9pt;}
.STYLE1 {
color: #FFFFFF;
font-size: 14pt;
}
.STYLE2 {font-size: 12pt}
.STYLE4 {color: #FF0000}
</style>
<title>给朋友写信</title>
</head>
<body>
<%if msg<>"" then%>
<br><%=msg%><a href="javascript:history.go(-1)">返回上一页</a>
<%else%>
<form action="mail.asp" method=post>
<table cellpadding="2" cellspacing="1" border="0" width="516" align=center>
<input type="hidden" name="action" value="ok">
<tr>
<td height="24" colspan="4" bgcolor="#003366" class=forumrow><div align="center" class="STYLE1 STYLE2">给朋友写信</div>
<div align="center"></div>
<DIV align="center"></DIV></td>
</tr>
<tr>
<td height="10" colspan="4" class=forumrow><div align="center"><span class="STYLE4">(请不要发送不良信息、无用信息)</span><br>
<%dim t,k,j,y
t=(cint(day(date()))*24+cint(hour(time())))*60+cint(minute(time()))
k=0
j=1
y=0
Do While application("zxip"&j)<>""
if application("zxip"&j)=Request.ServerVariables("REMOTE_ADDR") then
application("zxsj"&j)=t
y=1
end if
if t-application("zxsj"&j)>9 or t<application("zxsj"&j) then
k=k+1
else
if k>0 then
application.lock
application("zxip"&j-k)=application("zxip"&j)
application("zxsj"&j-k)=application("zxsj"&j)
application.unlock
end if
end if
if k>0 then
application.lock
application("zxip"&j)=""
application.unlock
end if
j=j+1
loop
if y=0 then
application("zxip"&j)=Request.ServerVariables("REMOTE_ADDR")
application("zxsj"&j)=t
else
j=j-1
end if
response.write("您的IP:"&request.serverVariables("REMOTE_ADDR"))
%></div></td>
</tr>
<tr>
<td colspan="4" class=forumrow>?</td>
</tr>
<tr>
<td width="89" class=forumrow> 好友E-mail:</td>
<td colspan="3" class=forumrow><input name=myemail type=text id="myemail" size=30>
<FONT color=#ff0000>*</FONT></td>
</tr>
<tr>
<td class=forumrow> 您的姓名:</td>
<td width="416" colspan="3" class=forumrow><input name=name type=text id="name" size=30>
<font color=#ff0000>*</font></td>
</tr>
<tr>
<td width="89" class=forumrow> 您的E-mail:</td>
<td colspan="3" class=forumrow><input name=email type=text id="email" size=30>
<FONT color=#ff0000>*</FONT> (如果朋友给您回信,将会回复到这个信箱)</td>
</tr>
<tr>
<td width="89" class=forumrow> 邮件标题:</td>
<td colspan="3" class=forumrow><input type=text name=title size=30 value="您好">
<FONT color=#ff0000>*</FONT></td>
</tr>
<tr>
<td width="89" rowspan="2" class=forumrow> 邮件内容:</td>
<td colspan="3" class=forumrow>
<textarea name="content" cols="50" rows="9" class="smallinput" id="content">支持HTML标记,分段在段末加<br></textarea><br><textarea cols="50" rows="9" class="smallinput" name="content1" id="test"></textarea>
<script language="javascript">
var str="<b>测试一把</b>";
txt=document.createElement('DIV');
txt.innerHTML=str;
test.appendChild(txt);
window.onbeforeunload=function oLoad(){document.location.reload()}
</script>
<FONT color=#ff0000>*</FONT></td>
</tr>
<tr>
<td colspan="3" class=forumrow><input type="radio" name="ishtml" value="1"<%if ishtml="" or ishtml="1" then response.Write(" checked")%>>文本格式<input type="radio" name="ishtml" value="2" <%if ishtml="2" then response.Write(" checked")%>>html格式</td>
</tr>
<tr>
<td width="89" class=forumrow></td>
<td height=20 colspan="3" class=forumrow>
<input type="Submit" value="发送邮件" name="Submit">
?
<input type="reset" name="Clear" value="重新填写"> </td>
</tr>
</table>
</form>
<%end if%>
</body>
</html>
[[it] 本帖最后由 thbwn 于 2008-4-15 10:46 编辑 [/it]]