Jump to content
xisto Community
Sign in to follow this  
mranimationist

Alerts, Buttons , Popups How to make alerts buttons and popups

Recommended Posts

Hi, All I hope yuo've enjoyed my last few posts and topics this may well be my last programming post for a week or two.Okay I am going to be talking about how to get a website that has javascript in it :)just copy the below If you do not understand it comment below

<html><head><title>My first javascript ~ Wooo!</title></head><body><script type="text/javascript">document.write("Hello World");</script></body></html> 

as you can see it goes along side HTMLSo thats the text part done Now on to the pro stuff.This is for an alert box

<html><head><script type="text/javascript">function show_alert(){alert("Hello! I am an alert box!");}</script></head><body><input type="button" onclick="show_alert()" value="Show alert box" /></body></html>

Now onto selection popup boxes

<html><head><script type="text/javascript">function show_confirm(){var r=confirm("Press a button");if (r==true)  {  alert("You pressed OK!");  }else  {  alert("You pressed Cancel!");  }}</script></head><body><input type="button" onclick="show_confirm()" value="Show confirm box" /></body></html>

Prompt Box

<html><head><script type="text/javascript">function show_prompt(){var name=prompt("Please enter your name","Name");if (name!=null && name!="")  {  document.write("Hello " + name + "! How are you today?");  }}</script></head><body><input type="button" onclick="show_prompt()" value="Show prompt box" /></body></html>

In this tut i am not going to explain what they meen because I do not have the time

Notice from rvalkass:
Please make sure you use the correct BBCodes in your posts.

Share this post


Link to post
Share on other sites

It is nice you tried to do something,but here is what you should do.

 

If you don't have time for explaining,why you are writing tutorial? When you will finish with the tutorial,post it and add some pictures,so people will understand it faster.

 

This things aren't so simple for beginners,you should describe more and more,for events,function args,function returns,etc.

 

By the way,i think adding scripts to the head is better , things that are not visible should(not must) be added to head part of the website.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.