PDA

View Full Version : Very basics of js


graphics@sn
07-05-2010, 10:32 PM
Hello there,

I am a print graphic designer just learning Dreamweaver.

All I want to do is use javascript that is already written. (I am not ready to write any myself.) But it seems that the very basic steps are left out of a lot of tutorials. I'm doing something wrong because the scripts aren't working.

These things I know:

-Some javascripts can all be added to your html page in the head tag
-Some javascripts can be linked to an external js document, still not sure how to make that work.
-jQuery is a javascript library.

So if there are any BASIC tips on how to use pre-written javascripts or jquery, I would be very appreciative.
Or if you know of any tutorials for this, I'd be grateful, I've only been able to find ones teaching how to write basic javascripts and I'm not ready for that yet.

Thank you for your time.

ranjan
07-05-2010, 11:03 PM
Since you are a designer, I presume you know your CSS. Under the said assumption here are a few tips you could research as a designer

1. Behavior

A web document has 3 layers. Content (HTML), Style (CSS) and Behavior (js or javascript). The goal for every good webpage is to keep these layers as separate as possible.

2. Degrees of Seperation

So just like with CSS, if you use same styles across multiple pages, you use an external stylesheet, if you use the same behaviors across multiple pages you use an external js file.

Having separate external files helps with maintainability

3. What is jQuery

With CSS you must have run into several cross browser issues. The case is even worse with javascript. Developer have hence always used snippets of code weaved together in a single "library" to attain cross browser compatibility of routine behavior used on their website.

Several libraries have thus abstracted such browser irregularities for us to have a uniform way to code them, Amongst these libraries jQuery seems to be the most "designer friendly"

4. Selection of quality cut and paste javascript

For a designer to evaluate the quality of the code they might want to use is a bit difficult. I would suggest you to ask for help at the various javascript communities and specifically for jquery go to their community forum at http://forum.jquery.com/

But before you ask for recommendations do your research and based on your requirements come up with a few alternatives and ask for people to recommend the best alternative amongst them.

graphics@sn
07-05-2010, 11:33 PM
Thank you for your response and your suggestions. I will study up on behaviors.

Thanks again!