roll over

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • HVTN Recruitment

    #1

    roll over

    i am trying to add a very simple roll over for my website. when the pages
    load most of the images load but there are a couple that don't. if i roll my
    mouse over the images that don't come up, they will appear. does anyone have
    any suggestions? i checked my image size and it's ok.

    thanks!

    ~kim


  • Lee

    #2
    Re: roll over

    HVTN Recruitment said:[color=blue]
    >
    >i am trying to add a very simple roll over for my website. when the pages
    >load most of the images load but there are a couple that don't. if i roll my
    >mouse over the images that don't come up, they will appear. does anyone have
    >any suggestions? i checked my image size and it's ok.[/color]

    You've mistyped the names in the src attribute of the image tags.
    Maybe because your SHIFT key isn't working.

    Comment

    • Douglas Crockford

      #3
      Re: roll over

      > >i am trying to add a very simple roll over for my website. when the pages[color=blue][color=green]
      > >load most of the images load but there are a couple that don't. if i roll my
      > >mouse over the images that don't come up, they will appear. does anyone have
      > >any suggestions? i checked my image size and it's ok.[/color]
      >
      > You've mistyped the names in the src attribute of the image tags.
      > Maybe because your SHIFT key isn't working.[/color]

      Too legit to shift.

      Comment

      • Kim Louis

        #4
        Re: roll over

        Hi Douglas, thanks for your reply. I'm new at this so could you please
        explain your answer?

        I checked the spelling and couldn't find anything.

        This is the source:

        <script language="javas cript">
        <!--

        if (document.image s) {

        // On images

        image1on = new Image();
        image1on.src="i mages/home-on.gif";

        image2on = new Image();
        image2on.src="i mages/volunteer-on.gif";

        image3on = new Image();
        image3on.src="i mages/faq-on.gif";

        image4on = new Image();
        image4on.src="i mages/trials-on.gif";

        image5on = new Image();
        image5on.src="i mages/safety-on.gif";

        image6on = new Image();
        image6on.src="i mages/community-on.gif";

        image7on = new Image();
        image7on.src="i mages/staff-on.gif";

        image8on = new Image();
        image8on.src="i mages/links-on.gif";

        image9on = new Image();
        image9on.src="i mages/contacts-on.gif";


        // Off images

        image1off = new Image();
        image1off.src=" images/home-off.gif";

        image2off = new Image();
        image2off.src=" images/volunteer-off.gif";

        image3off = new Image();
        image3off.src=" images/faq-off.gif";

        image4off = new Image();
        image4off.src=" images/trials-off.gif";

        image5off = new Image();
        image5off.src=" images/safety-off.gif";

        image6off = new Image();
        image6off.src=" images/community-off.gif";

        image7off = new Image();
        image7off.src=" images/staff-off.gif";

        image8off = new Image();
        image8off.src=" images/links-off.gif";

        image9off = new Image();
        image9off.src=" images/contacts-off.gif";
        }

        function imgOn (imgName) {
        if (document.image s) {
        document [imgName].src = eval(imgName + "on.src");
        }
        }
        function imgOff(imgName) {
        if (document.image s) {
        document[imgName].src = eval(imgName + "off.src");
        }
        }
        // -->

        </script>

        *** Sent via Developersdex http://www.developersdex.com ***
        Don't just participate in USENET...get rewarded for it!

        Comment

        • Evertjan.

          #5
          Re: roll over

          Kim Louis wrote on 24 sep 2003 in comp.lang.javas cript:
          [color=blue]
          > document[imgName].src = eval(imgName + "off.src");
          >[/color]

          Why the eval ?

          document[imgName].src = imgName + "off.src";

          ===

          Special taskforce against the senseless proliferation of the evil eval.

          --
          Evertjan.
          The Netherlands.
          (Please change the x'es to dots in my emailaddress)

          Comment

          • Lee

            #6
            Re: roll over

            Kim Louis said:[color=blue]
            >
            >Hi Douglas, thanks for your reply. I'm new at this so could you please
            >explain your answer?
            >
            >I checked the spelling and couldn't find anything.
            >
            >This is the source:[/color]

            The error is probably in your HTML, not the JavaScript.

            Comment

            • Douglas Crockford

              #7
              Re: roll over

              > I'm new at this
              [color=blue]
              > function imgOn (imgName) {
              > if (document.image s) {
              > document [imgName].src = eval(imgName + "on.src");
              > }
              > }[/color]

              Who taught you to do this? Who told you to misuse the eval() function that way?
              I want to know.

              People who are new at this should never use eval(). Never. But you should get in
              the habit of making your code more readable. It is hard to make it right if it
              is hard to look at.

              function imgOn(imgName) {
              if (document.image s) {
              document[imgName].src = imgName + "on.src";
              }
              }



              Comment

              • Kim Louis

                #8
                Re: roll over

                hmm? i'm not sure why the eval is in there but if i take it out, none of
                my images load...

                any more suggestions?



                *** Sent via Developersdex http://www.developersdex.com ***
                Don't just participate in USENET...get rewarded for it!

                Comment

                • Kim Louis

                  #9
                  Re: roll over


                  Thanks! I checked and checked my html but still can't find anything.
                  Would it be bad to post it to see if you can find something wrong?
                  Please forgive me if this is not appropriate.

                  <body bgcolor="#fffff f" text="#000000" link="#cc0000" alink="#66cc00"
                  vlink="#cc3333" >
                  <table summary="This table contains links to the HVTN" cellpadding="1"
                  cellspacing="4" border="0" width="406">
                  <tr valign="center" >
                  <td width="130" align="left">
                  <a accesskey="b" href="http://www.hvtn.org/">

                  <img src="images/hvtn.jpg" border="0" alt="HIV Vaccine Trials Network"
                  LONGDESC="http://www.hvtn.org/" width="130" height="82"></a>
                  </td>

                  <td width="360"><ce nter>
                  <img src="images/hvtu.gif" border="0" alt="HIV Vaccine Trials Unit
                  Seattle, Washington"
                  LONGDESC="Welco me to the Fred Hutch HIV Vaccine Trials Unit"
                  width="360" height="127"></center>
                  </td>
                  <td width="150" align="right">< a accesskey="c"
                  href="http://www.fhcrc.org/">
                  <img src="images/fhcrc.gif" width="118" height="65"
                  border="0" alt="Fred Hutchinson Cancer Research Center"
                  LONGDESC="http://www.fhcrc.org/"></a>

                  <a href="http://www.washington. edu">
                  <img src="images/uw.gif" width="150" height="36"
                  border="0" alt="University of Washington"
                  LONGDESC="http://www.washington. edu/"></a></td>
                  </tr></table>

                  <hr width=100% size="4" color="#000000" >

                  <table summary="This table contains links to other pages with in this
                  site"
                  cellpadding="1" cellspacing="0" border="0" width="630" >
                  <tr valign="top" align="left">
                  <td width="115" background="ima ges/bg.gif" width="115" height="189">



                  &nbsp;

                  <a accesskey="d" href="volunteer ing.htm"
                  onMouseOver = "imgOn('image2' )"
                  onMouseOut = "imgOff('image2 ')">
                  <img name="image2" src="images/volunteer-off.gif" border="0"
                  alt="Volunteeri ng" LONGDESC="Link to how to volunteer for a HIV vaccine
                  trial"
                  width="115" height="21"></a>


                  <a accesskey="i" href="faq.htm"
                  onMouseOver = "imgOn('image3' )"
                  onMouseOut = "imgOff('image3 ')">
                  <img name="image3" src="images/faq.gif-off" border="0"
                  alt="FAQs" LONGDESC="Link to list of frequently asked questions about
                  HIV vaccine trials"
                  width="115" height="21"></a>



                  <a accesskey="y" href="trials.ht m"
                  onMouseOver = "imgOn('image4' )"
                  onMouseOut = "imgOff('image4 ')">
                  <img name="image4" src="images/trials-off.gif" border="0" width="115"
                  height="21"
                  alt="Trials" LONGDESC="Link to information about our trials"></a>


                  <a accesskey="k" href="safety.ht m"
                  onMouseOver = "imgOn('image5' )"
                  onMouseOut = "imgOff('image5 ')">
                  <img name="image5" src="images/safety-off.gif" border="0" width="115"
                  height="21"
                  alt="Safety and Ethics page" LONGDESC="Link to information about safety
                  and ethics"></a>


                  <a accesskey="l" href="community .htm"
                  onMouseOver = "imgOn('image6' )"
                  onMouseOut = "imgOff('image6 ')">
                  <img name="image6" src="images/community-off.gif" border="0"
                  alt="Community Education" LONGDESC="link to a description about our
                  Community Education"
                  width="115" height="21"></a>




                  <a accesskey="n" href="staff.htm "
                  onMouseOver = "imgOn('image7' )"
                  onMouseOut = "imgOff('image7 ')">
                  <img name="image7" src="images/staff-off.gif" border="0" width="115"
                  height="21"
                  alt="Staff" LONGDESC="Link to a list of our staff"></a>


                  <a accesskey="o" href="Links.htm "
                  onMouseOver = "imgOn('image8' )"
                  onMouseOut = "imgOff('image8 ')">
                  <img name="image8" src="images/links-off.gif" border="0" width="115"
                  height="21"
                  alt="Web Resources" LONGDESC="Link to other sites regarding HIV and
                  vaccines"></a>

                  <a accesskey="p" href="contacts. htm"
                  onMouseOver = "imgOn('image9' )"
                  onMouseOut = "imgOff('image9 ')">
                  <img name="image9" src="images/contacts.gif" border="0" width="115"
                  height="21"
                  alt="Contact Information" LONGDESC="Link to how to contact the
                  HVTU"></a>


                  <p>

                  <br>

                  <br>

                  </td>


                  *** Sent via Developersdex http://www.developersdex.com ***
                  Don't just participate in USENET...get rewarded for it!

                  Comment

                  • Evertjan.

                    #10
                    Re: roll over

                    Kim Louis wrote on 24 sep 2003 in comp.lang.javas cript:
                    [color=blue]
                    > hmm? i'm not sure why the eval is in there but if i take it out, none of
                    > my images load...
                    >
                    > any more suggestions?[/color]

                    should not.

                    show us the code.

                    --
                    Evertjan.
                    The Netherlands.
                    (Please change the x'es to dots in my emailaddress)

                    Comment

                    • Lasse Reichstein Nielsen

                      #11
                      Re: roll over

                      "Douglas Crockford" <nospam@laserli nk.net> writes:
                      [color=blue]
                      > People who are new at this should never use eval(). Never. But you
                      > should get in the habit of making your code more readable. It is
                      > hard to make it right if it is hard to look at.[/color]

                      Except that this doesn't work.
                      [color=blue]
                      >
                      > function imgOn(imgName) {
                      > if (document.image s) {
                      > document[imgName].src = imgName + "on.src";[/color]

                      Should be:
                      document[imgName].src = window[imgName + "on"].src;[color=blue]
                      > }
                      > }[/color]

                      /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

                      • Lee

                        #12
                        Re: roll over

                        Kim Louis said:[color=blue]
                        >
                        >
                        >Thanks! I checked and checked my html but still can't find anything.
                        >Would it be bad to post it to see if you can find something wrong?
                        >Please forgive me if this is not appropriate[/color]

                        Here's one example of a mistyped src:


                        <img name="image3" src="images/faq.gif-off" border="0"

                        Comment

                        Working...