Wallpapers Forums Login

Simple Hello World Javascript Code

ok, so you want to start making javascript script. javascript is really fun because you can do alot of cool effects.

lets start my creating our first script.

i am using windows xp to write this tutorial, so open a blank notepad and copy and paste the following code into a blank notepad document

NOTE: if you dont have notepad, be sure to use an ascii text editor. dont use wordpad or a word process like word.exe, these programs format the text, and we dont want that. all microsoft windows come wint notepad, so you shouldn't use anything else.

JAVASCRIPT CODE:

<script language="javascript" type="text/javascript">
<!--
alert('Hello World Popup');
document.write('Hello Wallpaperama World! I wrote this message using javascript');
//-->
</script>


once you have copied and paste the code above, save it as: hello-world.html

now open hello-world.html with your browser, in my case, i am using internet explorer, but you can also use firefox if you prefer.

that's it, you will see your first script, the alert() function created the pop up you saw earlier, and the text on the browser was created by the document.write() function.

hope that helps

DEMO:

Related Content

Information

Share

wallpaperama | Wallpapers | Forums | Terms Of Service

copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5