Hello,can someone please tell me how to run javascript on any browser,i have windows 7 and whenever i write a javascript code and run it on a browser,it doesn't seem to work,example,if i type a code for alerting a user whenever he opens the page,the windows dialog box does not appear,i have tried in many ways to sort out this problem but i would really appreciate anyone's help,cheerio!!!
3 Replies - 402 Views - Last Post: 23 January 2013 - 02:36 PM
#1
problem with running javascript code on a browser
Posted 19 January 2013 - 08:29 AM
Replies To: problem with running javascript code on a browser
#2
Re: problem with running javascript code on a browser
Posted 19 January 2013 - 09:17 AM
In order for javascript to run, you must place the script tags within the head section or within the body section of your HTML document like so:
As long as the script tags on located within these two sections, the javascript will run on any browser (unless of course the javascript you write is not supported, ex: touchevents on a desktop).
You can also include an external script:
<html>
<head>
<script type="text/javascript">
$(document).ready(function() {
alert('head');
});
</script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function() {
alert('body');
});
</script>
</body>
</html>
As long as the script tags on located within these two sections, the javascript will run on any browser (unless of course the javascript you write is not supported, ex: touchevents on a desktop).
You can also include an external script:
<script type="text/javascript" src="myfile.js"></script>
This post has been edited by exiles.prx: 19 January 2013 - 09:18 AM
#3
Re: problem with running javascript code on a browser
Posted 20 January 2013 - 03:33 AM
you might also check, whether JavaScript execution is enabled at all.
#4
Re: problem with running javascript code on a browser
Posted 23 January 2013 - 02:36 PM
Dormilich, on 20 January 2013 - 04:33 AM, said:
you might also check, whether JavaScript execution is enabled at all.
To do that in FF:
1. Click "Firefox"
2. Click on 'Preferences'
3. Choose 'Content' tab
4. Assure 'Enable Javascript' is checked.
In iMac Safari:
1. Click 'Safari'
2. Click 'Preferences'
3. Choose 'Security'
4. Assure 'Enable Javascript' is checked.
In Chrome:
That browser is not available to me at this time. Will add later.
Page 1 of 1
|
|

New Topic/Question
Reply


MultiQuote





|