Jump to content

Recommended Posts

Hi,

 

  So i am very interested in learning javascript.  I have checked out the basic syntax, watched a couple video's i found on the net and i feel javascript will be a great addition to my web development skills. I'm particularly impressed with the mootools framework and will likely aim to develop in that.

 

Although i'm uncertain when it is appropriate to use and implement it, because i've read a TON of people say things like, 'javascript is a great tool, if you know how and when to use it!' being a novice at this language, i do not know 'how and when to use it'.

 

example:This hair studio hired me to make them a website.  she wants some animated stuff, i was going to do the whole thing in flash (which i hate), then i found out i could do it in javascript.  Should I bypass flash and use javascript, or just embed a simple flash file over the website.

 

She wants animation stuff similar to this website(minus the intro): http://www.onlysalons.com/Sample%20Sites/Site7/index.html

Link to comment
https://forums.phpfreaks.com/topic/113758-effective-javascript-coding/
Share on other sites

A good rule of thumb is the Keep It Simple Stupid theory.

 

Things you DO want to do with JavaScript:

-Make the user experience easier

-Some basic "fun" stuff is ok (aka animations)

 

Things you do NOT want to do with JavaScript:

-Make it so it only works if JavaScript is enabled

-Hide content behind AJAX calls (not SEO friendly)

-Slow down the site with a 500k JS file

 

Personally I like jQuery, but mootools is a good one too. Try to develop the site without JavaScript first, then add JavaScript to make things easier for the user. With the wide variety of browsers (especially mobile ones), the last thing you want is for you JS to error out, and they have your site become useless.

Hi,

 

   So i am very interested in learning javascript.  I have checked out the basic syntax, watched a couple video's i found on the net and i feel javascript will be a great addition to my web development skills. I'm particularly impressed with the mootools framework and will likely aim to develop in that.

 

Although i'm uncertain when it is appropriate to use and implement it, because i've read a TON of people say things like, 'javascript is a great tool, if you know how and when to use it!' being a novice at this language, i do not know 'how and when to use it'.

 

example:This hair studio hired me to make them a website.  she wants some animated stuff, i was going to do the whole thing in flash (which i hate), then i found out i could do it in javascript.  Should I bypass flash and use javascript, or just embed a simple flash file over the website.

 

She wants animation stuff similar to this website(minus the intro): http://www.onlysalons.com/Sample%20Sites/Site7/index.html

 

For animation like that, I suggest using Flash.  Then again, I'm hardly an animation expert, seeing as I have the artistic ability of a blind gnat.

 

Regarding JavaScript itself, a good rule of thumb is to never rely on JavaScript in order to get your site to function.  JavaScript should be used to enhance already existing functionality.  The heavy lifting should be done on the server.

 

I say it all the time, but as you're learning JavaScript, do so with an eye towards unobtrusive JavaScript.  This means keep your script entirely separate from your markup.  Things like:

<body onload="somefunction()">

are bad, as it couples your script to your markup.  Separating them increases readablity, improves maintenance, and saves you from many future headaches.  It's considered to be best practice and is generally considered the professional way of doing things.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.