主题:  ASP留言回车换行?

网络小精灵

职务:普通成员
等级:3
金币:1.1
发贴:761
#162005/12/1 14:39:07
我把
<script type="text/javascript">
//判断字符串是否为空字符串
function isNull(str){
var re=/^[ \s]*$/;
return re.test(str);
}
function checkform(obj){
if(isNull(obj.details.value)){
     alert("请输入留言内容!");
     obj.details.value="";
     obj.details.focus();
     return false;
    }else{
     return true;
    }
}
</script>加到</head>的前面,然后文本框是这样写:
<textarea name="details" id="details" cols="102`" rows="10" class="textarea"></textarea>
最后提交的时候是这样:
<input name="Add" type="submit" id="Add" value=" 添 加 " onClick="document.myform.action='ArticleSave.asp?action=add';document.myform.target='_self';" onsubmit="return checkform(this);">

存入数据库的时候有换行,但显示出来没有换行,不知为啥 :confused:


图片如下:



图片如下:


请问我的思路是不是正确的



浮尘

职务:普通成员
等级:3
金币:7.0
发贴:1258
#172005/12/1 20:19:52
<input name="Add" type="submit" id="Add" value=" 添 加 " onClick="document.myform.action='ArticleSave.asp?action=add';document.myform.target='_self';" onsubmit="return checkform(this);">
怎么放在这里呀,你有仔细看我给你的文件吗?



网络小精灵

职务:普通成员
等级:3
金币:1.1
发贴:761
#182005/12/1 21:04:59
对不起,看错了,可是我把onsubmit="return checkform(this);"放在<form后面也不行哦。。 :confused:
以下是我的全部源代码:
<%@language=vbscript codepage=936 %>
<!--#include file="Admin.asp"-->
<!--#include file="Conndb.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
dim rs
dim sql
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from SmallClass order by SmallClassID asc"
rs.open sql,conn,1,1
%>
<script language = "javascript">
var onecount;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("SmallClassName"))%>","<%= trim(rs("BigClassName"))%>","<%= trim(rs("SmallClassName"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;

function changelocation(locationid)
{
document.myform.SmallClassName.length = 1;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.SmallClassName.options[document.myform.SmallClassName.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}

function CheckForm()
{
if (editor.EditMode.checked==true)
     document.myform.Content.value=editor.HtmlEdit.document.body.innerText;
else
     document.myform.Content.value=editor.HtmlEdit.document.body.innerHTML;

if (document.myform.Title.value=="")
{
alert("产品名称不能为空!");
    document.myform.Title.focus();
    return false;
}
if (document.myform.Product_Id.value=="")
{
alert("产品编号不能为空!");
    document.myform.Key.focus();
    return false;
}
if (document.myform.Key.value=="")
{
alert("关键字不能为空!");
    document.myform.Key.focus();
    return false;
}
if (document.myform.details.value=="")
{
alert("产品中文说明不能为空!");
    document.myform.details.focus();
    return false;
}
if (document.myform.en_details.value=="")
{
alert("产品英文说明不能为空!");
    document.myform.en_details.focus();
    return false;
}
if (document.myform.Content.value=="")
{
alert("请上传图片!");
    editor.HtmlEdit.focus();
    return false;
}
return true;
}
function loadForm()
{
editor.HtmlEdit.document.body.innerHTML=document.myform.Content.value;
return true
}
</script>
<html>


<script type="text/javascript">
//判断字符串是否为空字符串
function isNull(str){
var re=/^[ \s]*$/;
return re.test(str);
}
function checkform(obj){
if(isNull(obj.details.value)){
     alert("请输入留言内容!");
     obj.details.value="";
     obj.details.focus();
     return false;
    }else{
     return true;
    }
}
</script>

<head>
<title>添加产品</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Admin_Style.css" rel="stylesheet" type="text/css">
</head>
<body onLoad="javascipt:setTimeout('loadForm()',1000);">
<table width="700" height="100%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="862" align="center" valign="top">
     <br>
<b>添 加 产 品</b><br>
<form method="POST" name="myform" onSubmit="return CheckForm(this);" action="ArticleSave.asp?action=add" target="_self">
<div align="center">
<table width="620" border="0" cellpadding="0" cellspacing="0" class="border" bgcolor="#E1F4EE">
<tr>
<td height="20" align="center"></td>
</tr>
<tr align="center">
<td class="tdbg">
            <table width="100%" border="0" cellpadding="0" bgcolor="#FFFFFF">
<tr>
<td width="150" height="22" align="right" bgcolor="#E1F4EE">所属类别:</td>
<td bgcolor="#E1F4EE">
<%
sql = "select * from BigClass"
rs.open sql,conn,1,1
        if rs.eof and rs.bof then
            response.write "请先添加栏目。"
        else
        %>
<select name="BigClassName" onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1">
<option selected value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
<%
            dim selclass
         selclass=rs("BigClassName")
    rs.movenext
         do while not rs.eof
            %>
<option value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
<%
         rs.movenext
     loop
        end if
rs.close
            %>
</select> <select name="SmallClassName">
<option value="" selected>不指定小类</option>
<%
            sql="select * from SmallClass where BigClassName='" & selclass & "'"
            rs.open sql,conn,1,1
            if not(rs.eof and rs.bof) then
            %>
<option value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
<% rs.movenext
                do while not rs.eof%>
<option value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
<%
                 rs.movenext
                loop
            end if
     rs.close
            %>
<%
            ranNum=int(9*rnd)+10
            iddata=month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum
            %>
</select> </td>
</tr>
<tr>
<td width="150" height="22" align="right" bgcolor="#E1F4EE">产品编号:</td>
<td bgcolor="#E1F4EE"> <input name="Product_Id" type="text"
id="Product_Id2" value="<%=iddata%>" size="10" maxlength="10"> <font color="#FF0000">*产品编号不可以相同,如你不能确定会重复,请勿改动他!</font></td>
</tr>
<tr>
<td width="150" height="22" align="right" bgcolor="#E1F4EE">产品名称:</td>
<td bgcolor="#E1F4EE"> <input name="Title" type="text"
id="Title2" size="50" maxlength="80"> <font color="#FF0000">*</font></td>
</tr>
<tr>
<td width="150" height="22" align="right" bgcolor="#E1F4EE">关键字:</td>
<td bgcolor="#E1F4EE"> <input name="Key" type="text"
id="Key2" size="50" maxlength="80"> <font color="#FF0000">*</font><br>
用来查找相关文章,可输入多个关键字,中间用空格分开。不能出现&quot;&quot;'*?,.()等字符。</td>
</tr>
<tr>
<td width="150" height="22" align="right" bgcolor="#E1F4EE">产品说明:</td>
<td bgcolor="#E1F4EE"> </td>
</tr>
<tr bgcolor="#E3E3E3">
<td colspan="2" align="right" bgcolor="#E1F4EE"> <div align="left">
<textarea name="Content" style="display:none"></textarea>
<iframe ID="editor" src="../editor.asp" frameborder=1 scrolling=no width="100%" height="405"></iframe>
</div></td>
</tr>
<tr height="25">
<td align="center" bgcolor="#E1F4EE" colspan="2">产品中文说明</td>
</tr>
<tr height="25">
<td align="left" bgcolor="#E1F4EE" colspan="2">
<textarea name="details" id="details" cols="102`" rows="10" class="textarea"></textarea></td>
</tr>
<tr height="25">
<td align="center" bgcolor="#E1F4EE" colspan="2">产品英文说明</td>
</tr>
<tr height="25">
<td align="left" bgcolor="#E1F4EE" colspan="2"><textarea name="en_details" cols="102`" rows="10" class="textarea" wrap="PHYSICAL"></textarea></td>
</tr>
<tr height="25">
<td align="right" bgcolor="#E1F4EE"><strong>内容分页方式:</strong></td>
<td height="18" bgcolor="#E1F4EE">
                     <select name="PaginationType" id="PaginationType">
<option value="0" <%if session("PaginationType")=0 then response.write " selected"%>>不分页</option>
<option value="1" <%if session("PaginationType")=1 then response.write " selected"%>>自动分页</option>
<option value="2" <%if session("PaginationType")=2 then response.write " selected"%>>手动分页</option>
</select> <strong><font color="#0000FF">注:</font></strong><font color="#0000FF">手动分页符标记为“</font><font color="#FF0000">[NextPage]</font><font color="#0000FF">”,注意大小写</font></td>
</tr>
<tr>
<td align="right" bgcolor="#E1F4EE">首页图片:
<input name="IncludePic" type="hidden" id="IncludePic" value="yes"></td>
<td height="75" bgcolor="#E1F4EE">
                    <input name="DefaultPicUrl" type="text" id="DefaultPicUrl" value="img/nopic.jpg" size="40" maxlength="120">
<br>
首页的图片,直接从上传图片中选择:
<select name="DefaultPicList" id="select" onChange="DefaultPicUrl.value=this.value;">
<option selected>不指定首页图片</option>
</select> <input name="UploadFiles" type="hidden" id="UploadFiles2">
</td>
</tr>
</tr>
<tr>
<td height="25" align="right" bgcolor="#E1F4EE">浏览权限:</td>
<td bgcolor="#E1F4EE"><select name="ReadLevel" id="ReadLevel">
<option value="9999" <%if session("ReadLevel")=9999 then response.write " selected"%>>站内游客</option>
<option value="999" <%if session("ReadLevel")=999 then response.write " selected"%>>注册用户</option>
<option value="99" <%if session("ReadLevel")=99 then response.write " selected"%>>企业用户</option>
<option value="9" <%if session("ReadLevel")=9 then response.write " selected"%>>VIP用户</option>
</select>
                     </TD>
</tr>
<tr>
<td width="150" height="25" align="right" bgcolor="#E1F4EE">已通过审核:</td>
<td bgcolor="#E1F4EE"> <input name="Passed" type="checkbox" id="Passed2" value="yes" checked>
是<font color="#0000FF">(如果选中的话将直接发布)</font></td>
<tr>
<td height="25" align="right" bgcolor="#E1F4EE">首页显示:</td>
<td bgcolor="#E1F4EE"><input name="Elite" type="checkbox" id="Passed" value="yes">
是<font color="#0000FF">(如果选中的话将在首页做为新产品显示)</font></td>
</tr>
<tr>
<td width="150" height="25" align="right" bgcolor="#E1F4EE">
                    滚动显示:</td>
<td bgcolor="#E1F4EE"> <input name="jingping" type="checkbox" id="Passed2" value="yes">
是<font color="#0000FF">(如果选中的话将在首页的精品栏里显示)</font></td>
</tr>
<tr>
<td width="150" height="25" align="right" bgcolor="#E1F4EE">录入时间:</td>
<td bgcolor="#E1F4EE"> <input name="UpdateTime" type="text" id="UpdateTime2" value="<%=now()%>" maxlength="50">
当前时间为:<%=now()%> 注意不要改变格式。</td>
</tr>
</table></td>
</tr>
</table>
</div>
<div align="center"><p>
<input name="Add" type="submit" id="Add" value=" 添 加 " onClick="document.myform.action='ArticleSave.asp?action=add';document.myform.target='_self';">
&nbsp;
</p></div>
</form>
</td>
</tr>
</table>
请浮尘兄帮我看看哪里错了。。



浮尘

职务:普通成员
等级:3
金币:7.0
发贴:1258
#192005/12/1 21:56:12
打包上传你的所用到的所有文件。如果数据库太大,删除无用的数据。



网络小精灵

职务:普通成员
等级:3
金币:1.1
发贴:761
#202005/12/5 11:26:12
已给你发信息,请查收。。



浮尘

职务:普通成员
等级:3
金币:7.0
发贴:1258
#212005/12/5 15:46:51
已经回复。



网络小精灵

职务:普通成员
等级:3
金币:1.1
发贴:761
#222005/12/5 19:40:25
已经再次给你发信息,麻烦查收,谢谢!



昙云寺的摇滚

职务:普通成员
等级:1
金币:0.0
发贴:51
#232005/12/8 15:51:10
看了半天还是不知道,因为我根本没有学习过这些东东
不过现在好想学!
不知道速成需要多少时间?