在ASP中
function SayErr(err_str,str1)
response.write "<script language=javascript>"
if err_str<>"" then
response.write "alert('"&err_str&"');"
end if
if trim(str1)="" then
response.write "if(history.length==0){opener='kingneed';window.close()}else{history.back();}</script>"
else
response.write "location='"&str1&"';</script>"
end if
response.end
end function
是可以运行的
但是我在.NET中改成这样
function SayErr(err_str,str1)
response.write("<script language=javascript>")
if err_str<>"" then
response.write("alert('"&err_str&"');")
end if
if trim(str1)="" then
response.write("if(history.length==0){opener='kingneed';window.close()}else{history.back();}</script>")
else
response.write("location='"&str1&"';</script>")
end if
response.end
end function
提示我出错:Compiler Error Message: BC30289: Statement cannot appear within a method body. End of method assumed
不知道这句是什么意思,请高手帮帮忙,教教我怎么用这段程序,谢谢!
function SayErr(err_str,str1)
response.write "<script language=javascript>"
if err_str<>"" then
response.write "alert('"&err_str&"');"
end if
if trim(str1)="" then
response.write "if(history.length==0){opener='kingneed';window.close()}else{history.back();}</script>"
else
response.write "location='"&str1&"';</script>"
end if
response.end
end function
是可以运行的
但是我在.NET中改成这样
function SayErr(err_str,str1)
response.write("<script language=javascript>")
if err_str<>"" then
response.write("alert('"&err_str&"');")
end if
if trim(str1)="" then
response.write("if(history.length==0){opener='kingneed';window.close()}else{history.back();}</script>")
else
response.write("location='"&str1&"';</script>")
end if
response.end
end function
提示我出错:Compiler Error Message: BC30289: Statement cannot appear within a method body. End of method assumed
不知道这句是什么意思,请高手帮帮忙,教教我怎么用这段程序,谢谢!
解决方案 »
- 问个问题 淘宝那个产品搜索排序怎么做的
- 类里的属性在声明的时候,就实例化吗?
- 怎样用js找gridview里面的textbox的值?
- 高手帮忙,如何在GRIDVIEW里删除DATASET的一行数据,急~~
- 各位大侠,能否在浏览器中使用脚本将客户端的可执行文件例如AutoCad等应用程序打开啊?十万火急 !!
- JS教本,如何实现两个DropDownList的同步?
- asp.net CheckBox 控件问题
- datagrid的DropDownList模板列?马上揭帖
- 同样一段解析XML文件的代码在Windows应用程序中好使,在Web应用程序中就不好用,难道牵涉一些权限的设置??望各位高手多多指点!!不好
- 新手高分请教简单问题,急急急急急 !!!
- ****************记录锁定问题,如何操作?
- ●●●●●●●●求建议 散分●●●●●●●●
是这个把,你应该试着去进行字符的转义
谢谢你的参与,但问题的重点不是这点,而是
<script runat=server>
function SayErr(err_str as string,str1 as string)
response.write("<script language=javascript>")
if err_str<>"" then
response.write("alert('"&ctype(err_str,string)&"');")
end if
if trim(str1)="" then
response.write("if(history.length==0){opener='kingneed';window.close()}else{history.back();}")
else
response.write("location='"&ctype(str1,string)&"';")
end if
print("</script >")
response.end
end function
</script>
这种形式,在<script>之中包含了<script>标签,所以会出错。
如果使用其它的</script >这种样式的,根本起不了javascript的作用!
谢谢 。
function SayErr(err_str as string,str1 as string)
response.write("<script language=javascript>")
if err_str<>"" then
response.write("alert('"&ctype(err_str,string)&"');")
end if
if trim(str1)="" then
response.write("if(history.length==0){opener='kingneed';window.close()}else{history.back();}")
else
response.write("location='"&ctype(str1,string)&"';")
end if
print("</script"&">")
response.end
end function
</script>
还要咱家自己想出来,头疼!