easy syntax question....

Discussion in 'Javascript' started by Michael, Oct 1, 2006.

  1. Michael

    Michael Guest

    Hi,

    why is it ok to have:

    function home_mouseover(){
    document.getElementById("hom").src = home_night.src;
    }

    <a href="./home.shtml" onmouseover="home_mouseover();">

    but not ok (results in a syntax error) to have:

    <a href="./home.shtml" onmouseover="document.getElementById("hom").src =
    home_night.src;">

    aren't these the same?

    Thanks for your help.

    Michael
    Michael, Oct 1, 2006
    #1
    1. Advertising

  2. Michael wrote:
    > Hi,
    >
    > why is it ok to have:
    >
    > function home_mouseover(){
    > document.getElementById("hom").src = home_night.src;
    > }
    >
    > <a href="./home.shtml" onmouseover="home_mouseover();">
    >
    > but not ok (results in a syntax error) to have:
    >
    > <a href="./home.shtml" onmouseover="document.getElementById("hom").src =
    > home_night.src;">
    >
    > aren't these the same?


    Both HTML and JavaScript use " to quote. You have to straighten that out.


    --
    John W. Kennedy
    "The blind rulers of Logres
    Nourished the land on a fallacy of rational virtue."
    -- Charles Williams. "Taliessin through Logres: Prelude"
    John W. Kennedy, Oct 1, 2006
    #2
    1. Advertising

  3. Michael

    Michael Guest

    "John W. Kennedy" <> wrote in message
    news:DWHTg.78$...
    > Michael wrote:
    >> Hi,
    >>
    >> why is it ok to have:
    >>
    >> function home_mouseover(){
    >> document.getElementById("hom").src = home_night.src;
    >> }
    >>
    >> <a href="./home.shtml" onmouseover="home_mouseover();">
    >>
    >> but not ok (results in a syntax error) to have:
    >>
    >> <a href="./home.shtml" onmouseover="document.getElementById("hom").src =
    >> home_night.src;">
    >>
    >> aren't these the same?

    >
    > Both HTML and JavaScript use " to quote. You have to straighten that out.
    >
    >
    > --
    > John W. Kennedy
    > "The blind rulers of Logres
    > Nourished the land on a fallacy of rational virtue."
    > -- Charles Williams. "Taliessin through Logres: Prelude"


    Thanks for that :)
    Michael, Oct 1, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hazzard
    Replies:
    2
    Views:
    623
    Hazzard
    Apr 6, 2004
  2. Bruno Desthuilliers
    Replies:
    5
    Views:
    370
    Bruno Desthuilliers
    Aug 29, 2007
  3. Ken Fine
    Replies:
    5
    Views:
    124
    Ken Fine
    Nov 28, 2003
  4. .Net Sports

    Easy string problem: invalid syntax????

    .Net Sports, Feb 8, 2007, in forum: ASP General
    Replies:
    9
    Views:
    207
    Roland Hall
    Feb 13, 2007
  5. gabriele renzi
    Replies:
    2
    Views:
    192
    gabriele renzi
    Dec 31, 2005
Loading...

Share This Page