Ahmed
Ahmed

Reputation: 2266

Pop Up not appearing in browser window

I'm writing code to display a pop up box and my code is

<html>
<body>
<script type="text/javascript">
windows.alert("Hello");
</script>
</body>
</html>

Nothing happens when i run this code!!

Upvotes: 0

Views: 75

Answers (2)

Niezborala
Niezborala

Reputation: 1857

Try:

<html>
<body>
<script type="text/javascript">
alert("Hello");
</script>
</body>
<html>

Upvotes: 1

Afzaal Ahmad Zeeshan
Afzaal Ahmad Zeeshan

Reputation: 15860

You're using windows which has no meaning in JavaScript.

Change that to window. And the code would look like this:

<script type="text/javascript">
 window.alert("Hello"); 
</script>

Windows is a product of Microsoft; or a carpenter, it has nothing to do with JavaScript. Window is used in JavaScript!

When you'll run this code, you'll get an alert box saying Hello.

Here is a fiddle for this: http://jsfiddle.net/afzaal_ahmad_zeeshan/zSf6q/

Upvotes: 2

Related Questions