473,387 Members | 3,781 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,387 software developers and data experts.

Can the "header" of a JavaScript dialogue box be changed?

When JavaScript writes out a dialogue box (like when confirm() is called)
the header or title of that dialogue box shows up as "JavaScript
Application"... Can this title be changed so that maybe you could stick the
name of your application in it?
Jul 23 '05 #1
8 11553
"Chris Markle" <cm*****@sendmail.com> skrev i meddelandet
news:GVwud.742045$8_6.299280@attbi_s04...
When JavaScript writes out a dialogue box (like when confirm() is called)
the header or title of that dialogue box shows up as "JavaScript
Application"... Can this title be changed so that maybe you could stick the name of your application in it?


No.

Joakim Braun
Jul 23 '05 #2
It'd be some fancy DHTML, but you could use an absolutely positioned
DIV tag to simulate a window and put a nested DIV inside it for the
title along with some text and buttons.

Jul 23 '05 #3
<html>
<head>
<title>test</title>
<script>

//Create a MessageBox class
function MessageBox(){
var Callback;

this.Show=
function(title, text, callback){

//Setup the event handler
this.Callback = callback;

//Set the text and show it
var h = window.document.getElementById("ConfirmTitle");
h.innerHTML = title;
h.parentNode.style.display="block";
window.document.getElementById("ConfirmText").inne rHTML = text;

Callback = callback;
}

this.Hide=
function(result){
var dv =
window.document.getElementById("ConfirmTitle").par entNode;
dv.style.display="none";
var s = Callback + "('" + result + "');";
eval(s);
}

this.AddToPage=
function(){

//Assemble a dialog and add it to the page
var i=0; var sb = new Array();
sb[i++]="<DIV style=\"font-family:sans-serif;display:none;
position:absolute;left:100px;";
sb[i++]="top:100px; width:200; border:solid 1px gainsboro;\">";
sb[i++]="<H5 id=\"ConfirmTitle\"
style=\"background-color:navy;color:white;\"></H5>";
sb[i++]="<P id=\"ConfirmText\"></P>";
sb[i++]="<input type=\"button\" value=\"yes\"
onclick=\"Msgbox.Hide('yes');\">";
sb[i++]="<input type=\"button\" value=\"no\"
onclick=\"Msgbox.Hide('no');\">";
sb[i++]="</DIV>";
document.write(sb.join(""));
}
this.AddToPage();
}

//Instantiate the Msgbox
var Msgbox = new MessageBox();
//Your function to do something with the result
function ResultHandler(result){
alert(result);
}

</script>
</head>
<body>
<A onclick="Msgbox.Show('Application Title','Text of the message
goes here... ','ResultHandler');" href="#" > Show Message </A>
</body>
</html>

Jul 23 '05 #4
Hi,

Chris Markle wrote:
When JavaScript writes out a dialogue box (like when confirm() is called)
the header or title of that dialogue box shows up as "JavaScript
Application"... Can this title be changed so that maybe you could stick the
name of your application in it?


You can't, but you can (and should) use a pop-up for this:

http://www.galasoft-lb.ch/myjavascri...000090401.html

The confirm, alert and input message boxes were never designed for user
interaction, only for debug purposes.

HTH,

Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 23 '05 #5
Ivo
"Laurent Bugnion" wrote
Chris Markle wrote:
Javascript confirm call outputs a dialogue box that writes out a message
and gives two choices: OK and Cancel. Can those buttons be relabelled
say to "Yes" and "No"? You can't, but you can (and should) use a pop-up for this:


Yes, the other post was an exact copy. Was that necessary? So once again:
Another, perhaps even nicer solution is to use a pop-in, a <div> or <iframe>
or so with your own buttons which you show and hide at will, at the same
covering the page to temporarily disable interaction. This solves all
problems with pop-up blockers and no resources are wasted on a whole new
window.
The confirm, alert and input message boxes were never designed for
user interaction, only for debug purposes.


Their original purpose is as relevant as the next thing. Those message boxes
are extremely useful and useable and I am sure many end users, from geeks to
total newbies, appreciate their lightweightness, straightforwardness and
absolute clarity to the point where even the buttons *always* read the same
thing.
--
Ivo
http://www.yorick.onlyfools.com/


Jul 23 '05 #6
Hi,

Ivo wrote:
"Laurent Bugnion" wrote
Chris Markle wrote:
Javascript confirm call outputs a dialogue box that writes out a message
and gives two choices: OK and Cancel. Can those buttons be relabelled
say to "Yes" and "No"?
You can't, but you can (and should) use a pop-up for this:

Yes, the other post was an exact copy. Was that necessary?


If the OP feels the need to post two copies (almost) of a message, one
can reasonably expect that he will look for answers to both. Especially
in this case, where it's obvious that it's not an error. And anyway, why
does it matter to you?
So once again:
Another, perhaps even nicer solution is to use a pop-in, a <div> or <iframe>
or so with your own buttons which you show and hide at will, at the same
covering the page to temporarily disable interaction. This solves all
problems with pop-up blockers and no resources are wasted on a whole new
window.


I agree.
The confirm, alert and input message boxes were never designed for
user interaction, only for debug purposes.

Their original purpose is as relevant as the next thing. Those message boxes
are extremely useful and useable and I am sure many end users, from geeks to
total newbies, appreciate their lightweightness, straightforwardness and
absolute clarity to the point where even the buttons *always* read the same
thing.


Their original purpose is extremely relevant to explain why they look
like they do, and why the developer has almost no way to modify them or
make them look better.

Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 23 '05 #7
Ivo
"Laurent Bugnion" wrote
Ivo wrote:
"Laurent Bugnion" wrote If the OP feels the need to post two copies (almost) of a message, one
can reasonably expect that he will look for answers to both. Especially
in this case, where it's obvious that it's not an error.


The OP could have put his questions in one post. Much more convenient for
everyone. You could have pointed that out to him.
And anyway, why does it matter to you?


I read it! I care. Whatever. I don't like my Usenet cluttered up with this
repeating copies of messages, and undoubtedly many others feel the same way,
now and until the end of the last Usenet archive.
The confirm, alert and input message boxes were never designed for
user interaction, only for debug purposes.


Their original purpose is as relevant as the next thing. Those message
boxesare extremely useful and useable and I am sure many end users, from
geeks to total newbies, appreciate their lightweightness,
straightforwardness andabsolute clarity to the point where even the
buttons *always* read the same thing.


Their original purpose is extremely relevant to explain why they look
like they do, and why the developer has almost no way to modify them or
make them look better.


Sure, it is relevant to explain those things. But when deciding on a way to
communicate with visitors to a webpage, the only things that count are
current things. Not original purposes. Just like the web's original purpose
was never anything pornographic or even commercial... From your words I get
the feeling that you find it wrong to use alerts and prompts in real-life
situations with real-life users, merely because of this original purpose. I
really don't follow, can't see any logic in that.
--
Ivo
http://4umi.com/web/javascript/





Jul 23 '05 #8
Hi,

Ivo wrote:
"Laurent Bugnion" wrote
Ivo wrote:
"Laurent Bugnion" wrote


If the OP feels the need to post two copies (almost) of a message, one
can reasonably expect that he will look for answers to both. Especially
in this case, where it's obvious that it's not an error.

The OP could have put his questions in one post. Much more convenient for
everyone. You could have pointed that out to him.


That's correct.
And anyway, why does it matter to you?

I read it! I care. Whatever. I don't like my Usenet cluttered up with this
repeating copies of messages, and undoubtedly many others feel the same way,
now and until the end of the last Usenet archive.


I was not aware it was your Usenet ;-) That said, you're right that
pointing it out to the OP would have been a good move.
Their original purpose is extremely relevant to explain why they look
like they do, and why the developer has almost no way to modify them or
make them look better.

Sure, it is relevant to explain those things. But when deciding on a way to
communicate with visitors to a webpage, the only things that count are
current things. Not original purposes. Just like the web's original purpose
was never anything pornographic or even commercial... From your words I get
the feeling that you find it wrong to use alerts and prompts in real-life
situations with real-life users, merely because of this original purpose. I
really don't follow, can't see any logic in that.


I do find it wrong when there are many better, more elegant ways, for
example, as you pointed out, floating DIVs and the such. That said, my
intent was not to force the OP to stop using alert confirm and input,
merely to explain why they look how they do. That could have been clearer.

Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 23 '05 #9

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

Similar topics

7
by: beliavsky | last post by:
Ideally, one can use someone's C++ code by just looking at the header files (which should contain comments describing the functions in addition to function definitions), without access to the full...
7
by: Sherry Littletree | last post by:
Hi All I am working on a site that has a large amount of common html on all its web pages. I am looking for a way to place this in a single file so, if changes are made, I can change this...
9
by: David D. | last post by:
Does the file extension matter when including a JavaScript file in an HTML page? Normally, one would include a JavaScript file in an HTML page using <script src="foo.JS" type="text/javascript">...
2
by: TadPole | last post by:
Hi all, My main problems are::::::::: 1. Set a value within a block container that can be used and changed by subsequent templates/block-containers/tables etc.. 2. get/determine/find the...
16
by: a | last post by:
Hi everybody, My config: Win XP (or 2003), Apache 2.0.54, PHP 5.1.2. I have been trying to handle the case of a lenghty opearation on the server while providing the user with feedback and...
6
by: dhillarun | last post by:
Hi everybody, I displaying file download window("save-as dialog box") using PHP "header()" function. How to track that user have clicked "save" button or "cancel" button???
1
by: kang jia | last post by:
hi i don;t know what is the difference between"Header" and "Meta" data in PHP, as they all can redirect web page. anyone can help me, it is very urgent!! thaks
7
by: TriAdmin | last post by:
I am working with a system that allow me to add custom fields but I can not add OnChange() language to the custom fields. So I want to have a function in the header that recognizes when fieldx is...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.