JavaScript


Samples


Tools

  • add

Resources & How-To's


Student Projects




This is sample javascript code that asks your name, and checks if it is NULL upon loading this page.



Code Used:
<script type="text/javascript">
//<![CDATA[
var myvariable = "andrew"
myvariable = prompt("welcome to javascript - enter your name")
if(myvariable === null) {
alert("You didn't enter your name, it is NULL")
}
alert("That is just one of the many things you can do with Javascript!")
 
document.write("Your name is " + myvariable)
//]]>
</script>