Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Msgbox Question 2

Status
Not open for further replies.

AgentM

MIS
Jun 6, 2001
387
US
How can I display a msgbox to the client browser , when I call the msgbox in an ASP script

Any help highly appreciated
 
The code in an ASP page gets processed by the server before it gets sent to the client, so you can't really force a msgbox explicitly in ASP. You could either escape from ASP (%>) and put in client-side VBScript when you need a msgbox, or just have the ASP write out the client-side script.
 
Thank you very much
How can I make ASP script write out a client side Script?
using Response.Write........
Or is there another way?
 
Simply use:

<SCRIPT LANGUAGE=&quot;VBScript&quot;>
MsgBox &quot;Dialog message!&quot;,8, &quot;Dialog title!&quot;
</SCRIPT>

in your HTML ouside the <% %> area..
Bear in mind that Netscape does not support VBScript and that the MsgBox will only be shown in an Internet Explorer client.. For multi-platform use Javascript instead, like this:

<SCRIPT LANGUAGE=&quot;Javascript&quot;>
alert(&quot;Dialog message!&quot;);
</SCRIPT>


NightWatcher
 
Please for the love of God don't use Message Boxes on webpages! I hate that. Wushutwist
 
Who cares !!

MsgBoxes are quite handy at times.. Figure this, you need to display a confirmation on delete for instances, then a dialog showing up, saying 'Are you sure? Yes/No' is the best way, otherwise you have to make a call to a html file containing the html alert, and only then do the delete.

The NET as we know it, could be alot faster for everyone if people used the fastest and most efficient way of achieving their goal.


NightWatcher
 
I have to disagree. I find it is better to do as much as possible on the server. Confirmations can just as easily happen thru server-side code without msgboxes. Adding an additional page be it asp, jsp, php, or whatever is easy if your framework is developed properly. Most people see it as an inconvenience because they don't use proper Object-Oriented Design where developing in the first place and it becomes a problem.

Message Boxes are ugly and the distract from the overall appeal of the site. How do you apply a css to a msgbox? Not to mention client-side programming (not in this specific case if you use javascript) is the pain because of cross browser issues. I don't even like to do client-side validation. Wushutwist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top