a) Adding external files to your site:
Once added to a FW page, it will allow you to specify a javascipt file and add the appropriate < script src="…" > tag. That is really the extend of actually adding the file.
b) Depending on the file being added, there may be a few different methods to accomplish your goal. the simplest is by coding the onclick event directly inside FW. So, where you want the onclick attached (an image, text, etc…), simply follow the same steps you would to add a hyperlink. Then in the hyperlink dialog, under the External tab you would probably want to enter the pound sign: ‘#’. Then press the ‘Extended…’ button and add your onclick code there:
Name = onclick
Value = myFunction(); return false;
Now, there are schools of thought that say this is bad form and to be avoided like the plague. It is not horribly wrong, just not ideal. For your first foray into JS, don’t get hung up on this just yet. As you become more familiar with JS, you will understand how and why alternative methods are preferred.
Please share if you are using such a JS framework.
Notice the 'return false; part? You are likely to want this command present. It tells the browser to stop after it has finished with the actual function defined in the onclick event. Otherwise what happens is the browser executes the JS, then follows with the normal href portion of the hyperlink. (sometimes you want this to happen, most times not). the normal operation of a hyperlink is to, first execute any JS (i.e. onclick), then follow the hyperlink as if it had no JS attached.
Since FW does not really do anything for you, that is to say it does what you tell it and provides a pretty face with which to interact, a basic understanding of JS and the hows and whys comes in handy.
Try this page: http://www.w3schools.com/JS/default.asp
JS is unforgiving in its execution. A wrong character or missing punctuation can easily cause all the scripts on the page to fail, very frustrating when still learning. In contrast, html is very forgiving, even showing pages that are grossly mal-formed.
freewaytalk mailing list
Update your subscriptions at: