www.webdeveloper.com
Results 1 to 5 of 5

Thread: How to run/test JavaScript?

Threaded View

  1. #1
    Join Date
    Jun 2009
    Posts
    28

    Question How to run/test JavaScript?

    Hello,

    I'm reading David Flanagan's "JavaScript: The Definitive Guide, 6th ed".

    It only actually tells users how to run JS code on page 311, where users are told of the following solutions:

    "Client-side JavaScript code is embedded within HTML documents in four ways:

    • Inline, between a pair of <script> and </script> tags
    • From an external file specified by the src attribute of a <script> tag
    • In an HTML event handler attribute, such as onclick or onmouseover
    • In a URL that uses the special javascript: protocol
    ."

    I was wondering what professional JS developers use to write and test their code: Do they use a good text editor with syntax high-lighting + autocompletion, hit F5 in the browser to reload the page every time they make a change, and use some add-on in the browser to investigate errors? Or are there full-fledged IDE's similar to MS VisualStudio for non-web languages?

    Thank you.
    --------
    Edit: For instance, I wrote this piece of code, which doesn't work (nothing displayed on screen when calling index.html), but Firefox doesn't display any error. How would I go trying to understand why it's not working?

    //mycode.js
    Code:
    <script>
    	function myfunc(){
    		alert("hello");
    	}
    </script>
    //index.html
    Code:
    <html>
    	<head>
    		<script language="JavaScript" src="mycode.js"> 
    		</script> 		
    	</head>
    	<body>
    		<script language="JavaScript">
    			myfunc();
    		</script>
    	</body>
    </html>
    Thank you.
    Last edited by littlebigman; 12-17-2012 at 09:26 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles