JavaScript - Confirm Boxes

Computer Education, Training & Tutorial Resources - ComputerEducationWorld.com
Home » Free Web Designing Courses » Introduction to JavaScript »

Place the following code in the body of your HTML document. (Remove the alert box if you like.):

<form>
<input type = ”button” value = “Click here to check the weather” onClick = “confirm(`Its
sunny today ‘ ) ; ” >
</form>
We have created an input button inside a form. Input elements such as buttons must always be placed inside a form, between <form> and </form> tags.
Take a look in a browser window at the results of this code. The onClick event handler means that when you click on the button, a confirm box pops up. An event handler allows you to specify what code to execute when an event takes place. You can change the message on the button or in the confirm box by changing the appropriate text in the code. Be sure you’re also using all semicolons, quotation marks, and other punctuation correctly.

Syntax is very important in JavaScript, unlike in HTML, where typos are often overlooked by
browsers. 
 


• • •
 



captcha PHP Script Free PHP captcha script free php
Website Design by WebWalas.com