473,738 Members | 11,146 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Replace alert/prompt/confirm in unicode environment!

Hi!

I have an asp application where I use a lot of javascript for validations
etc and as it is today I use alert, confirm and prompt dialogs. Now we are
adding support for unicode and I have problems with the font used to present
messages in alert, prompts and confirm dialogs. If I for examle paste a
chinese value in a prompt dialog it is shown om my machine as a vertical
bar. When I write the value back to a textbox <input type="text" the correct
chinese character is shown. The problem seems to be the font used in the
dialogs. I tried to change the font but could not get this to work.

So I'm looking to create my own dialogs replacing the alert/prompt/confirm.
Alerts can be replaced by either a popup window presenting the text in pure
html (a bit slow because of roundtrip to server) or a message could be
presented using dhtml (div or span). I have harder to fix the confirm/prompt
where I'm expecting a return value.

I have to support IE5.5sp2 and higher and also Netscape 7+ so I cannot use
the IE specific showModalDialog .

Any example how to solve this would be great!

Regards
/Hans
Jul 23 '05 #1
2 2838
"Hans" <so***@nospam.c om> wrote in message
news:cs******** **@green.tninet .se...
Hi!

So I'm looking to create my own dialogs replacing the
alert/prompt/confirm.
Alerts can be replaced by either a popup window presenting the text in
pure
html (a bit slow because of roundtrip to server) or a message could be
presented using dhtml (div or span). I have harder to fix the
confirm/prompt
where I'm expecting a return value.
You can open a new window and display "custom" content without making a
trip to the server. Let me say this is a completely contrived example,
your definition of morning, afternoon, evening and night may be
completely different, the time and/or time zone on the visitor's system
may be incorrect, etc. It is just an example of how to display dynamic
content without resorting to a trip to the server:

<script type="text/javascript">
var now = new Date();
var hours = now.getHours();
var greeting = 'Good ';
if (hours < 12)
{
greeting += 'morning';
}
else if (hours < 18)
{
greeting += 'afternoon';
}
else if (hours < 20)
{
greeting += 'evening';
}
else
{
greeting += 'night';
}
window.newWindo wHtml = [
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',
'<html>',
'<head>',
'<title>Untitle d</title>',
'</head>',
'<body>',
greeting,
'</body>',
'</html>'
].join('\n');
var w = window.open(
'javascript:ope ner.newWindowHt ml',
'windowName',
'...attributes. ..'
);
</script>
Any example how to solve this would be great!


As long as this is an Intranet (or otherwise controlled environment)
where you can _guarantee_ your users will always have JavaScript enabled
and will always allow popups, you can use windows created with
window.open() to create custom prompts and obtain feedback.

--
Grant Wagner <gw*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #2
Hi Grant and thanks for the answer!

This is an intranet environment and I know for sure javascript is enabled.

The code I have today (as I said) uses for example prompt, confirm and I
want to make as few changes in the code as possible to remove the use of
those functions. For example I use confirm when a user tries to delete a
record.

if (confirm("Delet e record"))

//do the actual delete

else

//do nothing or whatever is supposed to happen when the user is pressing
cancel.

One of the problems I have removing the confirm here is that a confirm is
waiting for an answer. If I open a new window how can I do this and stop
executing the actual delete until the user presses yes in the opened window?
The only solution I found was to split this into two functions. One that is
called when the user wants to delete a record. This function will open a new
window asking if he/she really wants to delete the record and if they press
yes I call another function in the opener window that do the actual delete.

Another solution I was looking at was to show a <div> with OK/cancel buttons
in it but the problem I have here is that I want the div to show up where
the user clicks on the delete button and I have problems with IE and
<select> tags where <div> are put behind the dropdown list. Since the
arrangement of fields is very flexible in the system dropdowns, edit boxes
etc may be placed almost anywhere so I cannot find a place to show the <div>
and be 100% sure it will not be behind a dropdown list.

Regards

/Hans
Jul 23 '05 #3

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

Similar topics

7
18439
by: Andy Fish | last post by:
Hi, now I know what the alert() function does, but can anyone tell me where I can find the specification or standards for functions like alert() and confirm(). They don't seem to be part of the ECMAScript language but aren't part of the DOM either. Now we seem to be finally reaching a stage of standards-compliant browsers, there seems to be a bit of a gap here.
9
4991
by: Justin Koivisto | last post by:
Is there a way to create an alert-like message box that uses a custom image? Basically, I want to replace the default ! image with something else. -- Justin Koivisto - spam@koivi.com PHP POSTERS: Please use comp.lang.php for PHP related questions, alt.php* groups are not recommended.
9
7560
by: Targa | last post by:
Ive seen alert scripts triggered by links but I need one that will cover any link or pressing the back/forward buttons. Any such thing? TIA
2
11527
by: Mike | last post by:
My page populates a table with a list of names and other information from a JavaScript object. I receive changes (adds, change & delete) to that list, convert it into a JavaScript object. I do understand how to add the new names to the list. I have 3 questions: 1) How can I search through the table rows to find the rows to be changed or removed?
11
4586
by: Alistair Saldanha | last post by:
I'm looking for the event that is fired by Internet Explorer to an "alert": <SCRIPT> Alert("You already have a session open") </SCRIPT> The event would be webBrowser.Document.???? Much appreciate any help you can give me. Thanks,
3
2606
by: dalei | last post by:
Is there a way to have non-English letters and symbols, such as the Greek letters or copyright sign, to appear in the box of alert()? Or is the alert () also available to people with other writing systems? I tried with such as &delta;. It didn't display. This question is also for the prompt (). Thanks.
1
1995
by: JAG | last post by:
I am getting an error using the replace method in one of my functions. I am using the replace method in the mail document function in my frameset .hta to change forward slashes to back slashes in the myVar string. The myVar string is obtained in my show document function: myVar = filename; In my mail document function:
3
1790
by: John Passaniti | last post by:
Hopefully someone can point out what I'm doing wrong. I find myself having to dynamically create HTML code, and have found that the usual way you see to do this is an unreadable mess, like this: blah('<span id="' + id + '"><a href="' + link + '">' + linkText + '</a></span>'); So instead, I would like to do something more like the variable interpolation in Perl and other languages:
0
8969
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8788
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
6751
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.