Re: Can MsgBox be used in ASP file ?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Logisticly think about what your trying to do. Your mixing server code with
client side code. Inside your <% %> server side code you are attempting to
make a msgbox appear. If this were to work then your msgbox would appear on
the server not the client. Their are many different ways to approach what
you want but the path depends on what exactly your doing. Typically you
would response.write back out any message you wish to appear. If it must
come in the form of a msgbox then you will need to do that inside client
side vbscript or you may be better off moving that to vbscript so it works
accross all browsers.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5";>
<script language="vbscript">
function alertuser(value)
msgbox value
end function
</script>
<script language="javascript">
function alertuser(value){
alert(value);}
</script>
</head>
<body>
<input type="button" name="vbscript" title="vbscript" value="vbscript"
onclick="alertuser('vbscript')" id="Button1"><br>
<input type="button" name="javascript" title="javascript"
value="javascript" onclick="alertuser('javascript')" ID="Button2">
</body>
</html>

Bryan Martin


"Trevor L." <Trevor_L.@Canberra> wrote in message
news:Oacf5Ay%23GHA.2408@xxxxxxxxxxxxxxxxxxxxxxx
BlankThis line in testurl.asp:
19 MsgBox (cURL & " does not exist!" & "Please try again")

returns this message:
Microsoft VBScript runtime error '800a0046'
Permission denied: 'MsgBox'
/testurl.asp, line 19

cURL has been defined as
Const cURL = "http://tandcl.com.au/indexx.html";
(This is a non existent file, hence my code to trap it)

Why is it so?

Are there other VBScript statements that can't be used ?

--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/




.



Relevant Pages

  • Re: can run javascript cant run vbscript - WHY
    ... > varies from browser to browser) not the DOM (Document Object Model, ... the VBScript Interpreter may choke on a function that does not ... I made no mention of server side code and was trying to help troubleshoot on ... > is he is trying to use a vbscript msgbox call in a web form."), ...
    (microsoft.public.dotnet.languages.vb.controls)
  • Re: From JScript back to VBScript???
    ... The jscript is server side and it must run before the vbscript. ... I don't want to make my page IE only by running the script client ... > a Visual Basic developer for the desktop (which is where I came from years ...
    (microsoft.public.scripting.vbscript)
  • Re: Interaction between browser and server not needed?
    ... I found this Visual Basic code chunk that reads all files/contents ... Or does the client ... sometimes have to interact with the server, ... This isn't VBScript, it's Visual Basic. ...
    (alt.html)
  • Re: VBA code for Outlook doesnt works in some cases
    ... VBScript -is clientside script invoked on button click. ... outlook on user's (client) computer. ... I assume the web server is IIS. ...
    (microsoft.public.outlook.program_vba)
  • Re: Javascript in Response.Redirect?
    ... Please try to understand that both vbscript and jscript ASP run on the ... server BEFORE any code on the client ... AND IF the client accepts session/ram cookies, ...
    (microsoft.public.inetserver.asp.general)