Jump to content

Is it essential ?


newceylon
 Share

Recommended Posts

I'm totally new J.script. But my next step is to learn it.I developed a web site recently for my friend.The web site is almost completed however with many errors.I have seen that almost all web sites have J.S. But none at all in my web site.Please Could any one tell me are there any J.S codes which commonly used to optimize web pages.then what are they. ?If you would like to see my project Go to : http://cnet.lk (don't laugh at me!)

Link to comment
Share on other sites

Javascript isn't essential, and it's actually better to learn how to make websites without Javascript.Javascript only should be used to make extra features that aren't indispensable for the website. I rarely use Javascript myself.But it is good to learn it anyways, it makes some jobs a little faster and easier than purely with PHP and it allows you to modify your page after it's loaded. But your websites should always be made to work well when Javascript is deactivated.

Link to comment
Share on other sites

JS is commonly used to validate form field values before posting a form, especially if you expect a time lag between your client and server. Everyone hates to submit a form, wait 45 seconds, and then discover they left a field blank. JS can handle that immediately. Otherwise, JS is used to make page "dynamic." You can create limited motion and image substitution effects using CSS by itself. True animation and content changes require JS.A common content change occurs when you have a series of select/option fields, and the content of one changes when the content of another changes. Example. Select Field A lets your client choose a country. Select Field B lets your client choose a city in that country. Obviously, all the options in Select Field B must change whenever a different country is selected in Select Field A. JS is ideal for this, and you've probably seen similar usage.I'm not aware that JS can *optimize* a page. To grow as a designer, you should become aware of the kinds of things JS can do. But only a trashy designer says, "Now I know this cool trick, so I'll use it all the time." Instead, you should start by asking what you want/need your page to do and then ask if JS is the best way to do it. Right now, you might be asking what you'd like your page to do that it currently doesn't. Could be, nothing.Never underestimate the impact of visual design. Just making things look good is more important than a bag of JS goodies.

Link to comment
Share on other sites

Yes as you said some has disabling JS in their browsers to more secure.Is JS use as alternative to CSS hack in I.E 6 ?I created a web site but with full of errors in I.E 6.works well with firefox and I.E7 and safari.
Few IE users turn JavaScript off, and when they do, they're usually using the latest stable version. So I'd say JS is a reasonable way to create implementations for non existing CSS stuff in older browsers.However, if the thing you want can be worked around with a CSS hack, you should instead try to place the IE specific code in conditional comments.JS can be used to "optimize" a page only when used wisely, as already pointed out by Deirdre's Dad. One way that JS can be used while still working for browsers with JS off is to use it to pre cache images, like
new Image().src='image.png';

A case in mind is when you have a large (4KB+) image used for a :hover state. Normally, the browser will start downloading it only as soon as the user hovers over the selected element, which results in a delay, during which only the background color is visible. With this, it will start downloading it as soon as the page loads, so as soon as the user hovers over the element, they'll immediatly see the image.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...