473,405 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

javascript validation

I have a method that I use for Javascript validation (see below). What
I want to do is change the alert title, buttons, icon etc. Does anybody
know the correct syntax to do this?

private void Gen_Alert(string Key, string msg)
{
string str = "";
str += "<script language='javascript'>";
str += "alert('"+msg+"')";
str += "</script>";
RegisterStartupScript(Key, str);
}
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Dec 13 '05 #1
3 1699
You can't. There are several pre-defined functions in JavaScript that do
similar things. The alert() function simply pops up a MessageBox with an OK
button on it. The confirm() function pops up a MessageBox with an OK and
Cancel button, and returns true if OK is clicked, and false if Cancel is
clicked. The propmt() function pops up a MessageBox with a text box and an
OK button, and returns the string entered into the text box.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but you can't make it stink.

"Mike P" <mi*******@gmail.com> wrote in message
news:uf**************@TK2MSFTNGP14.phx.gbl...
I have a method that I use for Javascript validation (see below). What
I want to do is change the alert title, buttons, icon etc. Does anybody
know the correct syntax to do this?

private void Gen_Alert(string Key, string msg)
{
string str = "";
str += "<script language='javascript'>";
str += "alert('"+msg+"')";
str += "</script>";
RegisterStartupScript(Key, str);
}
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***

Dec 13 '05 #2
Kevin,

Thanks for the info about confirm() and prompt(), they may come in
useful!
Cheers,

Mike
*** Sent via Developersdex http://www.developersdex.com ***
Dec 13 '05 #3
You're quite welcome, Mike. I probably should have mentioned another, more
difficult alternative, which is to design a popup that does whatever you
need. It is more difficult because, for example, many browsers don't allow
popups. This can be overcome, however, by the use of an
absolutely-positioned div with a zIndex higher than the rest of the page.
Making it look like a dialog box is somewhat problematic, and unlike a
regular popup, its position is nailed to the position of the window below
it. It also requires a good bit of DHTML (JavaScript/HTML/CSS) programming
to use it, but if you design it well, it can be re-used in the same (and
other) web applications. The greatest difficulty with this sort of solution
is making it look and behave more or less the same in all browsers. But it
can certainly be done.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but you can't make it stink.

"Mike P" <mi*******@gmail.com> wrote in message
news:OL****************@TK2MSFTNGP15.phx.gbl...
Kevin,

Thanks for the info about confirm() and prompt(), they may come in
useful!
Cheers,

Mike
*** Sent via Developersdex http://www.developersdex.com ***

Dec 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Sue | last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided to improve character checking on my project. In my project I only had to do very basic validation. Therefore, I only had one...
9
by: tzigone | last post by:
hello, i use asp.net validation controls in my site. i wonder whether usin javascript validation will fasten page load speed? there are currently lots of requiredfieldvalidator now is it better t...
111
by: Retlak | last post by:
The recommended (on dozens of websites) and effective (works in Netscape, MSIE, Mozilla, probably others) way to detect if a browser has Javascript turned off is to put this in the <head>: ...
2
by: GIMME | last post by:
Background ... I've created a web application that allows a user to create an HTML application from IE. The application itself creates an XML representation of a XHTML form. The XHTML...
5
by: Allan M. | last post by:
I have a series of select boxes that must be populated client side, because they interact with each other. The design specification calls for these boxes to be updated without having to make a...
5
by: | last post by:
Hi all, Has anyone been able to write some custom javascript on the onclick event of submit button to do certain things like disable submit button, only submit form once etc. This was a breeze...
8
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
27
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it...
6
by: Peter Afonin | last post by:
Hello, I'm creating an application in ASP.NET 1.1. I need to check whether at least one checkbox in my datagrid has been checked. To do this, I'm using Javascript - I'm adding this code to...
5
by: Peter Afonin | last post by:
Hello, I'm not an expert in Javascript, so I'm seeking an advice. As I mentioned in my previous post, I use Javascript to check whether at least one checkbox in the datagrid has been checked....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.