Question in JavaScript, browser blocking my functions

Hello everyone.
Sorry if I post in wrong place, there were no section for newbies in .js forum :frowning:

Can someone explain why chrome and IE blocking my javascript code? javascript is enabled in both, and .js from other website’s works well …

Here’s my code:

<!doctype html>
	<title>Your page title</title>
	<meta name="description" content="page_description">
	<meta name="keywords" content="keyword1, keyw2, keyw3">
	<meta name="author" content="MrPaulius">
	<meta charset="utf-8">
	<link rel="stylesheet" href="style.css">
	<script type="text/javascript" src="java.js"></script>


		<input type="text" name="inputA" id="inputA" size="4">
		<input type="text" name="inputB" id="inputB" size="4">
		<input type="button" value="Add up" onclick="newWindow()">


function newWindow(){;


Your JavaScript needs to be within <script> tags, ideally just before the closing </body> tag.

Like this:

      function newWindow(){;


sorry forgot to mention, js code is in external file.

If it is in an external file then that file needs to be attached into the HTML with a script tag just before the </body>

It is attached in head, isint that where it supposed to be?
My IE says that it restricted page from running scripts or ActiveX controls.

Once i allow it, js works. I can understand why… js works properly in other websites.

I’m guessing it’s because the js wants to open a window and the browsers are warning you.

Maybe there are some option settings like “allow script to …” somewhere you need to change?

With IE, you will need to allow the JS to run explicitly when you are running the file locally.
I haven’t tried this, but according to Google you can up enable Active Content from local files in the advanced tab of the Internet Options.

Well, at least i know now there is nothing rong with my code :slight_smile: thanks guys for help :wink: