简体   繁体   中英

Trying to create a messagebox or alert which displays the value of an asp-classic variable

I found this post and tried the first suggestion, and while it will display what I need it to, I suddenly get lots and lots of javascript errors. It's generating about 30 expected end of statement errors. The message box works great though, which is why I'm trying to figure out if there's another solution to pop-up the value of an ASP variable. I'm trying to get it to display inside of an ASP function.

Got it!

I ended up using this:

    %><script language=javascript>
    var temp = '<%=message%>';
    alert(temp);
    </script><%

I don't know why I didn't think to do that before!

I had to work with some legacy code recently and had this same problem. This will work as well if the variable was previously defined:

Response.Write "<script language='JavaScript'>alert('The value is " & variable_name& "');</script>"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM