Learning JAVASCRIPT From Scratch 2

1 Conversation

The first thing is to note that javascipt works differently in IE to Netscape - Netscape invented the language but Microsoft just had to make changes. Now some scripts have to be written twice to enable them to work on all Javascript enabled browsers. Even the writing of different pages may be neccessary with automatic transfer to the correct page for the browser.

On some older browsers, JS does not work at all - so you have to ensure that the page still displays your needs without it.

I am going to check the scripts I write on both browsers and will document it if one of them does not work on one of them.

I will also explain any html I use - this way it will get into my head and hopefully help those who are also just starting to learn how to code a webpage.

I will be using MS Note Pad to write the scripts but any text editor will do which can save the file in .txt and also .html.

To force Word Pad to save a file in a certain format, enclose the file name in ["] ie save the file test.html as "test.html"

I have made a folder on drive d: called javascript and save all experiments there - then by clicking on a newly made file, I can test the script in a browser off line.

Right lets start with something something simple. We want to put some wording on the page - OK I know there are simple ways of doing that - but we have to start somewhere.

script 1
<html>
<head>
<title>
document.write - script 1
</title>
</head>

<body>


<!-- script starts here -->
<!-- hide script from from non JS browsers
<script>
document.write("This text will appear on the screen")
</script>
end hiding script -->



</body>
</html>
explanation to be added

html & Javascript syntax = explains what the html tags are there for.
http://www.bbc.co.uk/h2g2/guide/A624502


Bookmark on your Personal Space


Conversations About This Entry

Entry

A623747

Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry


Written and Edited by

Disclaimer

h2g2 is created by h2g2's users, who are members of the public. The views expressed are theirs and unless specifically stated are not those of the Not Panicking Ltd. Unlike Edited Entries, Entries have not been checked by an Editor. If you consider any Entry to be in breach of the site's House Rules, please register a complaint. For any other comments, please visit the Feedback page.

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more