首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

[VB]小弟我想用这么一段在ASP中借过来的程序,可是出错?怎么处理呢

2011-12-29 
[VB]我想用这么一段在ASP中借过来的程序,可是出错?怎么办呢?在ASP中functionSayErr(err_str,str1)response

[VB]我想用这么一段在ASP中借过来的程序,可是出错?怎么办呢?
在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
不知道这句是什么意思,请高手帮帮忙,教教我怎么用这段程序,谢谢!

[解决办法]
<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>
还要咱家自己想出来,头疼!

热点排行