Mega Code Archive

 
Categories / JavaScript Tutorial / Language Basics
 

Mix complicated code with HTML

< html> <head> <title>A Simple Page</title> <script language="JavaScript"> <!-- //  --> </script> </head> <body> <p onclick="units = prompt('How many do you want','Enter quantity');alert('Cost per unit is $9.99, therefore total cost for ' + units + ' is ' + units * 9.99);">Click here to specify quantity</p> </body> </html>