Click to See Complete Forum and Search --> : Alert Box Script


javame16
09-21-2003, 10:32 AM
I have a question, where would you find a script for alert boxes? Ive seen the right-mouse button disable script.

I wanted to know where to get a script, where an alert box pops up, and when you click ok, another alert box pops up, and so on and so on.

Thanks,

96turnerri
09-21-2003, 12:32 PM
im not sure what type of alert box you are after?

this page has lots on have a look and youll find the one ur after

http://javascript.internet.com/messages/

javame16
09-21-2003, 12:51 PM
http://javascript.internet.com/messages/alert.html

Thats the type of alert box I want. After the alert box pops up and you click OK, another ALERT box pops up, and you have to click OK, then ANOTHER alert box pops up, lol.

Thats what im looking for, and possibly to start the script when the page loads instead of clicking on a button or link...

96turnerri
09-21-2003, 03:11 PM
hers the first step

<html>
<body onload="drawAlert()">
<SCRIPT LANGUAGE="JavaScript">
function drawAlert () {
alert ("This is an alert message that can say whatever you want!");
}
</SCRIPT>
<body>
</html>

Charles
09-21-2003, 03:35 PM
<body onload="while (true) alert ('And it serves you right for using JavaScript!')">

AdamBrill
09-21-2003, 03:37 PM
In other words you want to make an endless loop of alerts? :rolleyes: It is a simple script, but I won't help you create a script that abuses the users. Scripts like that are the reason that 13% of users disable JavaScript... :mad:

AdamBrill
09-21-2003, 03:39 PM
Originally posted by Charles
<body onload="while (true) alert ('And it serves you right for using JavaScript!')"> Umm... I can't believe you posted that... :rolleyes:

That just makes me sick...

Charles
09-21-2003, 03:41 PM
Originally posted by AdamBrill
Scripts like that are the reason that 13% of users disable JavaScript... :mad: It's certainly one of the reasons people disable JavaScript. And if we can only get that 13% up around 50% then perhaps we can get lazy web authors to make their pages work as well without as with JavaScript. So please, use that annoying script and mouse trails and especially resize my window.

AdamBrill
09-21-2003, 03:49 PM
However, "not working well without JavaScript" and "totally abusing JavaScript" are two different things...

I still can't believe you posted that. :) And you didn't even tell them that they shouldn't use it... :eek:

Do you have a twin brother that knows your login information? :p

Charles
09-21-2003, 03:53 PM
There's a difference between something that has an overlooked nasty side effect and something that is supposed to offend. This person is trying to abuse all visitors to his or her site.

And while I've no twin I do have a bad habit of forgetting to log out after I've used a public computer.There are scores of people out there using my identity.

javame16
09-21-2003, 03:58 PM
I wouldnt consider abusive. Its not going to be that many java scripts, im in a web design class at school and were going, actually I think the teacher may, present them on an over head projector.

So thats why I wanted to ALERT boxes to pop up, I was going to try the previous script, umm what was it, oh right, the script where you close a window another opens, you close that window another opens, you close that window another opens.

The trick is to stopping these, CTRL ALT DEL and close out Internet Exlporer. :) It's just for a good laugh, and I can assure you nothing else malicious.

javame16
09-21-2003, 04:02 PM
BTW, there are going to be no more then 5 of these windows.

javame16
09-21-2003, 04:15 PM
Ok, 1 more thing. While you have provided me with the script, that would seem and could be super annoying.

For example, I could change: "I ACKNOWLEDGE IM A RETARD!" and they would click ok and it would loop over again, im not looking for that.

Im looking for a series of messages, thats a little to much looping. :)

Thanks

Charles
09-21-2003, 04:39 PM
<script type="text/javascript">
<!--
var quotes = ['I am the LORD your God, who brought you out of the land of Egypt, out of the house of slavery; you shall have no other gods before me.', 'You shall not make for yourself an idol, whether in the form of anything that is in heaven above, or that is on the earth beneath, or that is in the water under the earth. You shall not bow down to them or worship them; for I the LORD your God am a jealous God, punishing children for the iniquity of parents, to the third and the fourth generation of those who reject me, but showing steadfast love to the thousandth generation of those who love me and keep my commandments. ', 'You shall not make wrongful use of the name of the LORD your God, for the LORD will not acquit anyone who misuses his name.', 'Remember the sabbath day, and keep it holy.', 'Six days you shall labor and do all your work. But the seventh day is a sabbath to the LORD your God; you shall not do any work - you, your son or your daughter, your male or female slave, your livestock, or the alien resident in your towns. For in six days the LORD made heaven and earth, the sea, and all that is in them, but rested the seventh day; therefore the LORD blessed the sabbath day and consecrated it.', 'Honor your father and your mother, so that your days may be long in the land that the LORD your God is giving you.', 'You shall not murder.', 'You shall not commit adultery.', 'You shall not steal.', 'You shall not bear false witness against your neighbor.', 'You shall not covet your neighbor’s house; you shall not covet your neighbor’s wife, or male or female slave, or ox, or donkey, or anything that belongs to your neighbor.']

onload = function () {while (quotes.length) alert(quotes.shift())}
// -->
</script>

javame16
09-21-2003, 04:51 PM
Thanks for the script, but it says there's an error? Could you explain how to set it up?

Ive pasted it into my body, but that doesnt seem to work...


Sorry about all the work this post is creating

Charles
09-21-2003, 05:01 PM
Put that piece of script in your document's HEAD element and rid yourself of anyother scripts on the page. If it still isn't working then you are doing something wrong and you need to post a URL.

S1L3NC3
09-21-2003, 09:27 PM
Heres five alerts like you wanted:


<script language="javascript">
alert("Whatever you want to say");
alert("Whatever you want to say next");
alert("whatever you want to say after that");
alert("You get the idea");
alert("Yet again");
</script>


Repeat as needed. That will work in the body or the head.

96turnerri
09-22-2003, 05:46 AM
ATTENTION Charles if you are so against javascipt then why do you read and post in the javascript forum? there are plenty of other forums and we are happy to use SOME javascipt in our sites, i admit some people do go a bit OTT when putting js on their sites, but if thats what they wish to do then its up to them

</rant>
:p

Charles
09-22-2003, 06:25 AM
Originally posted by 96turnerri
ATTENTION Charles if you are so against javascipt then why do you read and post in the javascript forum? there are plenty of other forums and we are happy to use SOME javascipt in our sites, i admit some people do go a bit OTT when putting js on their sites, but if thats what they wish to do then its up to them

</rant>
:p Because I'm not against JavaScript. Quite to the contrary, there are times when its use is a benefit and there are times when its use is benign. But there are also times when its use causes great harm.

96turnerri
09-22-2003, 06:54 AM
ok then, i thought u were, as your not i apologise and i agree with the post above by you, sometimes it is benign. CASE CLOSED :D

javame16
09-22-2003, 08:35 PM
Unfortunately, the script where the 10 commandments were posted does not work.
Even with this basic script:

<HTML>
<HEAD>
<script type="javascript">
<!--
var quotes = ['I am the LORD your God, who brought you out of the land of Egypt, out of the house of slavery; you shall have no other gods before me.', ']
onload = function () {while (quotes.length) alert(quotes.shift())}
// -->
</script>
<TITLE>HEHE</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>

But, the easier script posted by SIL does work, thanks anywys. :)

S1L3NC3
09-22-2003, 08:53 PM
Simplicity rules ;)

Charles
09-23-2003, 05:29 AM
Originally posted by javame16
Unfortunately, the script where the 10 commandments were posted does not work.
Even with this basic script:

<HTML>
<HEAD>
<script type="javascript">
<!--
var quotes = ['I am the LORD your God, who brought you out of the land of Egypt, out of the house of slavery; you shall have no other gods before me.', ']
onload = function () {while (quotes.length) alert(quotes.shift())}
// -->
</script>
<TITLE>HEHE</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>

But, the easier script posted by SIL does work, thanks anywys. :) The version with the commandments works just fine. I tested it before I poseted it, as I do most all scripts that I post, and I just tested it again. That shorter version is missing a single quote. The HTML is awful as well, but not so bad that it would cause the problem. Properly type the array literal and all will be well.