不懂 js ,请教大家一条句子?

jiuhexuan 2004-01-09 10:24:44
function Str4Sql(s){
return s.replace(/\'/gm,"''");
}

有什么问题
提示:

Microsoft JScript 编译错误 错误 '800a03ee'

缺少 ')'

E:\DOING\COCOON COUNTER 6\SUPERVISE\../_inc/chkLogin.asp,行67

return s.replace(/\'/gm,"''");

...全文
44 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
jiuhexuan 2004-01-09
  • 打赏
  • 举报
回复
miller530(4design.Miller) :

去掉“)”也是不行
Camellia402 2004-01-09
  • 打赏
  • 举报
回复
to lbd8848(lbd)
可以的
lbd8848 2004-01-09
  • 打赏
  • 举报
回复
<script language="javascript" runat="server">好像不能在服务器端吧
miller530 2004-01-09
  • 打赏
  • 举报
回复
function Str4Sql(s){
return s.replace(/\'/gm,"''"));
}

后面多了一个")"
say1no2 2004-01-09
  • 打赏
  • 举报
回复
正则表达式!我只认识它,但是,不会!!
jiuhexuan 2004-01-09
  • 打赏
  • 举报
回复
<script language="javascript" runat="server">
function chkLogin(b){
iSiteId = Session("site_id");
if(isNaN(iSiteId)||iSiteId<1){
// not logined
if(b){
// do login
if(doLogin()) return true;
else doAlert("","Login.asp?innerUrl="+sUrl);
}else{
iSiteId = 0;
return false;
}
}else{
return true;
}
}

function doLogin(){
var sUID = Str4Sql(Request("UID")+"");
var sPWD = Str4Sql(Request("PWD")+"");
var sInnerUrl = Str4Sql(Request("innerUrl")+"");
if(sUID.length<1||sUID=="undefined") return false;
sSqlString = "select SiteId,pwd,SiteOpen from t_Site where UID='"+sUID+"'";
var oRs = oConn.execute(sSqlString);
if(oRs.EOF) doAlert("用户不存在","Login.asp?innerUrl="+sUrl);
else if(sPWD!=oRs.fields.item(1).value&&oRs.fields.item(2).value<1) doAlert("密码错误","Login.asp");
iSiteId = oRs.fields.item(0).value;
Session("cc_count_6_site_id") = iSiteId;
if(sInnerUrl&&sInnerUrl!="undefined") doAlert("",sInnerUrl);
//else doAlert("","Login.asp");
return true;
}

/*
function formatMaxValue(x){
if(x<5) return 5;
else if(x<10) return 10;
else if(x<25) return 25;
return 50-(x%50)+x;
}
*/

function formatMaxValue(x){
var iBase = Math.pow(10,(x+'').length-1);
if(iBase<10) iBase=10;
return iBase-(x%iBase)+x;
}

function isPostBack(){
if(Request.ServerVariables("REQUEST_METHOD")+""=="POST")
return true;
else
return false;
}

function doAlert(s,u){
Response.write("<"+"script language='JavaScript'>\n");
if(s) Response.Write("alert('"+s.replace("'","\\'")+"');\n");
if(u) Response.Write("location.href='"+u.replace("'","\\'")+"';\n");
Response.write("</script"+">\n");
if(u) Response.End();
}

function Str4Sql(s){
return s.replace(/\'/gm,"''"));
}

function getMonthName(n){
var a = new Array("一","二","三","四","五","六","七","八","九","十","十一","十二");
return a[n];
}
</script>
<%
var oQueryDate = Request.QueryString('QueryDate');
if(oQueryDate.Count==1){
var aQueryDate = oQueryDate(1).split('-');
if(aQueryDate.length==3) var sQueryDate = new Date(parseInt(aQueryDate[0]),parseInt(aQueryDate[1])-1,parseInt(aQueryDate[2]));
else sQueryDate = new Date();
if(isNaN(sQueryDate)) sQueryDate = new Date();
}
var iSiteId = 0;
var dToday = oQueryDate.Count?sQueryDate:new Date();
var dYesterday = new Date(dToday - (1000*60*60*24));
var iSecOfMonth=(new Date(dToday.getYear(),dToday.getMonth()+1,1) - new Date(dToday.getYear(),dToday.getMonth(),1));
var iDayOfMonth = parseInt(iSecOfMonth/1000/60/60/24);
var dLastMonth = new Date(dToday - iSecOfMonth + 1000*60*60*24);
var dLastWeek = new Date(dToday - (1000*60*60*24)*6);
//var dLastMonth = new Date(dToday.getYear(),dToday.getMonth(),1);
//var iDayOfMonth = parseInt((dToday-dLastMonth)/1000/60/60/24)+1;
var sToday = formatDateTime(dToday,2);
var sYesterday = formatDateTime(dYesterday,2);
var sLastMonth = formatDateTime(dLastMonth,2);
var sLastWeek = formatDateTime(dLastWeek,2);
var iNowHour = dToday.getHours();
var iDayOfWeek = 7;
var iMonthOfYear = 12

Date.prototype.getCnWeekName = function(){
var a = new Array("日","一","二","三","四","五","六");
return a[this.getDay()];
}
%>

这一页全部内容,麻烦看一下
DeltaCat 2004-01-09
  • 打赏
  • 举报
回复
其他错了吧,这部分语法正确啊
lbd8848 2004-01-09
  • 打赏
  • 举报
回复
<script>
<!--
function Str4Sql(s){
return s.replace(/\'/gm,"''");
}
alert(Str4Sql("dddd'ddd"));
-->
</script>
我试了一样,没出错呀,是其他地方出错吧
xieyj 2004-01-09
  • 打赏
  • 举报
回复
正则表达式,不懂

28,407

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧