Javascript in a php document

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bo Dudek

    Javascript in a php document

    Hi

    I have this thought, that I'd like to share:

    Sometimes I'm using javascript in my webpages to create different kind
    of form-interactions. Sometimes I have an inputfield, and in this
    field theres a short description text like "Type your name here".

    When a user clicks the field, I use the OnFocus and OnBlur
    eventhandlers to remove the description text to allow the user to type
    his own text.

    But isn't it right, that no matter what I do, the javascript will
    ALWAYS be interperated by the users browser and NOT by the server? And
    therefore, if the user doesn't allow javascript, he won't be able to
    use my little nifty thing?

    Kind regards
    Bo Dudek

  • Lasse Reichstein Nielsen

    #2
    Re: Javascript in a php document

    bo@cykel.dk (Bo Dudek) writes:
    [color=blue]
    > But isn't it right, that no matter what I do, the javascript will
    > ALWAYS be interperated by the users browser and NOT by the server?[/color]

    Absolutely correct.
    [color=blue]
    > And therefore, if the user doesn't allow javascript, he won't be
    > able to use my little nifty thing?[/color]

    Correct. That is why Javascript should only be used to enhance a page,
    not to create the basic fuctionality. There are quite a lot of people
    who browse without Javascript (11% in some counts), either because
    they use browsers without Javascript or because they have turned it
    off. A good page should degrade nicely when Javascript isn't
    available, and still retain full functionality, even if it might
    require a little more work to use it.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    Working...