SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 36

Thread: Why JavaScript?

  1. #1
    SitePoint Guru
    Join Date
    Dec 2001
    Location
    San Diego, CA
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why JavaScript?

    I hardly ever use JavaScript in websites. The only times I use it are for image rollovers and popup windows with a specific size. I have the code for those and can do them without the help of Dreamweaver's built in code for it. However, I don't know much more beyond that...and I haven't needed to. Give me some JavaScript and I can understand what it is doing, but I couldn't have come up with the code for it from scratch.

    I have been building websites for almost 2 years now and haven't found much of a need for knowing JavaScript. Why is it that every job posting requires that you know JavaScript as well as HTML?

    I have built a few PHP applications and utilized JavaScript to do things like refreshing a frame after submitting information. However, it took me about 1 minute to find some code that did that. I have not found a use for JavaScript beyond very basic things such as this and so I haven't invested any time into the language...yet. Am I missing something with JavaScript? Can it actually do things to make my websites that much better by using it?

    Most everything I have been doing lately is PHP/MySQL driven sites. When I have a form, I usually check the values using PHP thus no real need to do so with JavaScript. The CMS that I build are so simple and direct, there isn't a need for fancy JavaScript there either.

    So, I am still asking myself this question: What really is the big deal with JavaScript? Why does every employer require that you know it very well?

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My, that's not an easy question. But, I'll have a crack at it.
    • To address your point about validation. The primary advantages to client-side are:
      1. Fewer round trips to the server (gravity of this benefit depends on your site's traffic)
      2. Instant feedback to the user, and oftentimes more helpful.
    • Javascript takes on a whole new meaning when you consider DOM scripting. Content switching systems, adding removing OPTIONs from SELECTs, resorting a table, etc. all can be very helpful and beneficial to a page
    • You cannot deny the fact that people like interactivity with their websites. If you don't use Flash, where do you think you're gonna get it?
    • As I know you are aware, PHP cannot interact with the client...just delivers data. Like the tests at BrainBench.com. Their whole site is XML and jsp, but each question is timed by a javascript timer.
    • This bulletin board. All the vB code stuff, smilies and whatnot. Javascript.
    • Sure, I know that all/most of the stuff I mentioned above is out there someplace to be cut and pasted (see: fValidate) but do you think a company really wants to hire a cut-and-paster?
    • Maybe these employers of which you speak just need rollovers
    Better? That term is far too subjective to allow for a direct answer...but no, you don't NEED javascript to make a good website, but javascript can make your site more user-friendly, more functional, and more interesting. Those things only make your site better if it needs them, but alot of employers are looking for those benefits.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    Rehab is for quiters! spartan's Avatar
    Join Date
    Apr 2002
    Location
    Cape Town, South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm, I dont see how you can expect to work for a company, as a webdeveloper and not be able to do client side scripting and if you need to do Client side scripting then you're probably going to need to do it in Javascript, since vbscript, as we all know, is only supported by IE.

    I think that once you start getting into Javascript, you will realise the power that it gives the webdeveloper as far as client side validation goes, but also making you page interactive as beetle pointed out (ps. I dont like him, cause he always beets me to the post
    ). I suggest you go to a site like dynamicdrive.com and have a look around the scripts they offer to get a real idea of what can be done with some decent javascripting and DHTML.

    it adds a whole new dimention to webdevelopent.

    try it... its worth it!
    Spartan
    ---------------------
    It's like our sergeant told us before one trip into the jungle. Men! Fifty of you are leaving on a mission. Twenty-five of you ain't coming back.
    -Mr.Payne

  4. #4
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by spartan
    ...cause he always beets me to the post )...
    Boo-yah!
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  5. #5
    SitePoint Guru
    Join Date
    Dec 2001
    Location
    San Diego, CA
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was looking around the Dynamic Drive site at different scripts. The only thing that I saw that I would probably use is drop down menus and maybe image slideshows. Things like scrolling windows and images flying around are things I would never use (too lame in my opinion).

    I guess I should ask people what kinds of scripts they use and feel are the most practical. I suppose when I design a site, I know my limitations of what I can and can't do...but if I knew JavaScript I would design sites differently knowing I had less limitations.

  6. #6
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by sccr410
    but if I knew JavaScript I would design sites differently knowing I had less limitations.
    Well, perhaps. Here's a case in point.

    I did a simple vertical nav design for a site once, and the rollover consisted of a tiny triangle appearing next to the link. Did I make a separate rollover GIF for each of the (10 I think) buttons? Hell no! I made the whole nav one image, slapped an image map on that sucker that controlled 1 floating triangle that moved into place making it look like a rollover. What did this do for the site? 1. Less images to load. Faster for the user and less bandwith cost to the client. 2.Computationally less expensive. The js and renderer didn't have to switch an entire image...but just modified the top style property of the little triangle. I'd link you to the site, but it never got past pre-development and is no longer online.

    I think you'll find some of the things Aaron has to say interesting in that article...

    P.S. If you code in PHP, why are you complaining about javascript? They are both C-based scripting languages, and it is very easy to port some code from one to the other. The major learning curve difference is for PHP: learning all the server-related stuff (DB, file access, environment, etc) and for JS: the code's interactivity with the DOM.
    Last edited by beetle; Oct 16, 2002 at 09:18.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  7. #7
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check out automation. This is extremely useful if you have clients who are a pain in the ***

  8. #8
    SitePoint Guru
    Join Date
    Dec 2001
    Location
    San Diego, CA
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am definitely not complaining about JS at all here. I guess I am just very interested in why people feel it is such a necessary skill to have since I rarely use it. I doubt it would take me long to figure it out as I have taken a few classes in Java programming and also know PHP. It isn't about not wanting to learn (just haven't gotten around to it yet).

  9. #9
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    northern Maine
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Be careful not to ruin your site's accessibility by relying upon Javascript. If you can dynamically create a drop down menu by clicking a link, more power to you, but make sure the link still goes somewhere relevant for browsers without Javascript, or for surfers who have disabled it.

    A few logical exceptions exist to that rule (as with any rule though). But if your core site does not require Javascript, then why change that? Enhance it, not make it dependent on more factors.


    And a special note about client-side validation with Javascript:

    You had better still check the input for validity on the server side. I can override any Javascript on your page through the javascript: protocol. If I so felt like putting "zork!" for a telephone number in an input you check on the fly, I certainly can. I can either remove events that check for it onkeypress, or redefine functions that may pick it up as bad input.



    All in all, Javascript has its place. W3C DOM technical reports are the future of dynamic effects, when coupled with markup such as XHTML or SVG. Javascript is the only cross-browser way of accessing these interfaces exposed by the web browser, and certainly knowledge of this can't hurt.

    Javascript has more uses than just web pages though, and has been implemented in everything from RPG Makers to 3D-rendering programs.

    But knowing JS is never a necessity of designing a "good" website.
    Jason - Contact Me
    Supermoderator @ CodingForums

  10. #10
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by sccr410
    I guess I am just very interested in why people feel it is such a necessary skill to have since I rarely use it.
    Well, there's no one answer for that. Pretty much the prerogative of the person who finds it necessary.

    I'd like to add one final thing about validation. (this is more for the benefit of the spectators to this thread...) that what jkd said about not relying on javascript validation is VERY important. Case in point: obviously many people who visit my fValidate site are developers, and many of them (from what I've found out) like to disable the JS for kicks. You see, I also validate my contact form with PHP, which notifies me every time it is needed....which is more often than I expected.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  11. #11
    Rehab is for quiters! spartan's Avatar
    Join Date
    Apr 2002
    Location
    Cape Town, South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was looking around the Dynamic Drive site at different scripts. The only thing that I saw that I would probably use is drop down menus and maybe image slideshows. Things like scrolling windows and images flying around are things I would never use (too lame in my opinion).
    I understand exactly what you are saying and most of those things are pretty tasteless. I just wanted you to see what can be done... how you use that power is really up to you. you dont have to make korny looking flying windows and mouse trails that irritate users.

    so.... lets try again
    *I'll make you a javascript lover yet*

    this intro is what someone with a little more style achieved by putting together some of those tricks you saw on dynamicDrive, in his own, more tastefull, way. (in my opinion, anyway)

    the main thing is for me was that you should look at those crappy flying windows on dynamic drive and not go "jees, korny, I'll never use that" but rather go "MAN! I can move stuff around... WHAT IF.... I created a cool looking menu system that looks like a clock and all the menu items move in a circle when the user moves his mouse.... yeah and then fade in some images based on the menu item that is at the top of the circle..."

    see what I'm saying... if you dont know javascript, the options and the opertunity to come up with some clever idea to make your page interactive and stand out because of visual affects just is not there... unless you use flash.

    and at the moment, my opinion about that is simple... If I see something basic in flash(not hugely complex movies), I emidiately go and see if I cant achieve the same effect in Javascript and DHTML and you'd be supprised how far you can actually get...
    Spartan
    ---------------------
    It's like our sergeant told us before one trip into the jungle. Men! Fifty of you are leaving on a mission. Twenty-five of you ain't coming back.
    -Mr.Payne

  12. #12
    SitePoint Guru
    Join Date
    Dec 2001
    Location
    San Diego, CA
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I am not a Flash lover. However, for those simple animations that are sometimes requested I do use Flash 4 (everyone has it by now). The problems that could arise with browser compatibility with JS outweigh the possibility of someone not having Flash installed (IMO).

    Anyway, I will eventually find some time to learn JS (right now I am starting to get into ASP since I work with a professor at school and all their sites use ASP). I do think JS will be beneficial to me in helping me create CMS's for clients and adding a little here and there on visitor side (I'm more of a use cool, static images instead of moving things around on the page kind of person)

    Oh ya, thanks for reminding me of simple Flash animations. I have to make one. "Can you make our logo kind of flip over from "'Welcome to Hirozen' to 'Japanese Restaurant'?"...blah

  13. #13
    Rehab is for quiters! spartan's Avatar
    Join Date
    Apr 2002
    Location
    Cape Town, South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by sccr410
    I guess I am just very interested in why people feel it is such a necessary skill to have since I rarely use it.
    thats a easy one...

    When you work for company, one that is serious about what they do, you are going find yourself in positions where you need to solve problems... mostly that is what programmers do.... and the thing about solving a problem is, that you need tools to do it. The more tools you have the more like you are to solve the problem quicker than the next guy.

    and that is exactly what the guy sitting across from you in a interview room is thinking when he askes you what you can do. He wants the guy with the most tools.

    If you call a guy to come and look at a problem with your car and the mechanic rocks up with a hammer and pair of pliers! and he says to you! "hey, dont worry mate I can do everythin those guys with the whole big toolbox can do" are you going to let him work on your car? no matter how good he is with that hammer... he aint comin nowhere near my car, I'm tellin you that!

    the other thing is thinking outside the box... dont ask "why use it?" but rather ask... "what can I do with it?"

    2 more cents!

    I think I'm broke
    Spartan
    ---------------------
    It's like our sergeant told us before one trip into the jungle. Men! Fifty of you are leaving on a mission. Twenty-five of you ain't coming back.
    -Mr.Payne

  14. #14
    SitePoint Guru
    Join Date
    Dec 2001
    Location
    San Diego, CA
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am asking "what can I do with it?"

  15. #15
    Rehab is for quiters! spartan's Avatar
    Join Date
    Apr 2002
    Location
    Cape Town, South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hehe
    anything you like
    Spartan
    ---------------------
    It's like our sergeant told us before one trip into the jungle. Men! Fifty of you are leaving on a mission. Twenty-five of you ain't coming back.
    -Mr.Payne

  16. #16
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by sccr410
    I am asking "what can I do with it?"
    Remember, DHTML is 1-part CSS, 1-part Javascript.

    Take a look a www.youngpup.net again. He makes wonderful use of DHTML to present his scripts, articles, and snippets with his _ui_.webapp interface. THAT, my friend, is what you can do.

    If after all these examples, suggestions, hints, links and opinions, you STILL don't know what javascript can do for you, then I suggest you forget about it and move on.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  17. #17
    Rehab is for quiters! spartan's Avatar
    Join Date
    Apr 2002
    Location
    Cape Town, South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that is a shhweeeet site beetle.

    I hope everybody here looked at the way he manages the frames and how he slides them open and closed when loading a page. It looks realy profesional. very stylish.

    nice
    very nice
    Spartan
    ---------------------
    It's like our sergeant told us before one trip into the jungle. Men! Fifty of you are leaving on a mission. Twenty-five of you ain't coming back.
    -Mr.Payne

  18. #18
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just a note...it's not actually frames in the HTML sense, but visual only. It's all DIVs.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  19. #19
    Rehab is for quiters! spartan's Avatar
    Join Date
    Apr 2002
    Location
    Cape Town, South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah
    I looked at that specificaly.

    I HATE FRAMES! always have, always will.
    Iframe is the only thing I'll touch and only to do server side stuff in the background so the user gets the impression that state is being maintained and entire page doesn't get submited all the time (I love that trick)

    is there still that problem with iframes always being on top, no matter what you set their, or the other elements z-indexes to?
    that really irritated me!
    Spartan
    ---------------------
    It's like our sergeant told us before one trip into the jungle. Men! Fifty of you are leaving on a mission. Twenty-five of you ain't coming back.
    -Mr.Payne

  20. #20
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Only IE 5.5 and 6.0 support z-index for IFRAMEs that I know of.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  21. #21
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by beetle
    Only IE 5.5 and 6.0 support z-index for IFRAMEs that I know of.
    Opera 6 supports them, but often suffers from indecisive rendering problems, IE5+ Mac supports them with identical problems to Opera.

    Moz supports them perfectly.

    Netsape 6/7? Depends on if the month has the letter N or J in it.
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  22. #22
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    northern Maine
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Bill Posters
    Netsape 6/7? Depends on if the month has the letter N or J in it.
    Netscape 7 is Mozilla 1.0.1
    Netscape 6.2 is Mozilla 0.94

    Therefore, Netscape 6+ is a branded Mozilla, and at least NS7 should be able to do anything a relatively recent Mozilla does. (With each signifcant branch though, 1.1, and 1.2, they get more different..)
    Jason - Contact Me
    Supermoderator @ CodingForums

  23. #23
    Extremists Beware! Rockrz's Avatar
    Join Date
    Mar 2001
    Location
    In God's Country!
    Posts
    1,317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check out automation. This is extremely useful if you have clients who are a pain in the ***
    Can anyone show me a link to a live example of this?
    I'd like to see exactly what it is....
    .

  24. #24
    SitePoint Guru
    Join Date
    Dec 2001
    Location
    San Diego, CA
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by beetle
    Remember, DHTML is 1-part CSS, 1-part Javascript.

    Take a look a www.youngpup.net again. He makes wonderful use of DHTML to present his scripts, articles, and snippets with his _ui_.webapp interface. THAT, my friend, is what you can do.

    If after all these examples, suggestions, hints, links and opinions, you STILL don't know what javascript can do for you, then I suggest you forget about it and move on.
    OK, well, I know what CAN be done with JavaScript. I guess a better question would be "How does it apply to me?" Sure, that site has cool little animations that move stuff around. But, that is what Flash does and I hate flash. I don't like designing sites that move around and animate. I design nicely laid out sites (at least I think) that presents the information in a way suitable to the audience without much distraction. As far as practicality is concerned, what types of things does JS do that I should know about in order to make a functional webpage? I know someone already said that you don't need JS at all...which is true. However, I'm sure there are certain things that JS can do that makes like so much simpler. One of those being image rollovers (which I already know how to do).

  25. #25
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I may have the perfect example for you. I about 16 months ago, I did a site for a large law firm in Dallas, Carrington Coleman (CCSB). It was a large project in which I probably invested over 240 hours. It was a fantastic financial success for the company I was working for at the time. CCSB was super-happy with the site.

    Now, over a year later, the magainze 'Law Office Computing' held it's 4th annual website contest, and that CCSB site tied for 2nd place out of some 300+ sites in the 'Large Firm' category. If you read my last post at that thread, you will see that I attached a PDF of the new-release the CCSB received. If you read that, I think that you will realize that part of the reason the site won was because of the interactivity it provided. Note: the site as it is currently has changed some since I was involved

    So, what benefit comes of this? Well, I'm independant now, working for myself. But, the Marketing Director over at CCSB was always pleased with my work, but was super-pleased with the award. So, guess what? They contacted me to do the next set of revisions/updates/additions to their site.

    I hope I have made my point.

    Oh, and one more thing...
    Originally posted by sccr410
    But, that is what Flash does and I hate flash. I don't like designing sites that move around and animate.
    That is a hurdle you need to overcome. You cannot let your subjections/opinions get in the way of business. As I said in my first post, you CANNOT deny the fact the people like interactivity. If a client (or potential client) want's interactivity in their site, then THAT is how it applies to you. Because if you can do it, you get paid. If you can't, they look somewhere else.

    Oh, and just for clarificaition, interactiviy != animation. I believe I've given some good, functional examples of interactivity. If you still need more for clarification, I got 'em.
    Last edited by beetle; Oct 19, 2002 at 11:05.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev





Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •