473,568 Members | 3,143 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 2823
"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
18434
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...
9
4977
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
7553
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
11508
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...
11
4567
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
2599
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
1990
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
1780
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...
0
7601
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...
0
7913
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6274
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5496
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...
0
5217
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...
0
3651
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...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
931
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...

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.