Problem with my onmouseover

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jeddiki
    Contributor
    • Jan 2009
    • 290

    Problem with my onmouseover

    I am having problems getting my onmouseover to work

    This is what I have in the external.js file:

    The tips "theTips1" should be invisable when the page opens
    but they are not.


    Code:
    function start(){
    document.getElementById("theTips1").style.visibility = "hidden";
    document.getElementById("ticker").style.visibility = "hidden";
    }  // end of function
    
    
    function show_tips(targetID) { 
        document.getElementById(targetID).style.visibility = "visible"; 
    }  // end of function
    
    function hide_tips(targetID) { 
        document.getElementById(targetID).style.visibility = "hidden"; 
    }  // end of function
    
    This code is in the body
    <body onload="start();externalLinks();">
    and then lower down I have this:


    Code:
    <div id="theTips1"  class = "tips" style='width:400px; text-align:left; position:absolute;left:400px; top:450px;'>
    <b>Writing your Product Description.</b> <br>
    Write as much as you can - the more you write the better your advert will look. Your format will be kept;
     so you can use the enter key to make seperate paragraphs to build an attractive advert.<br>
    <br>
    Your first sentences will be displayed in the listing as well as on your main advert so<br>
    make these first sentences interesting and inviting.
    <br>
    <br>
    </div>
    
    <div class="page_name">
    Control Panel
    </div> <!-- End div: page_name --> 
    
    <div class="pg_whole">
    <span class="pg_head">Add a New Product.</span>
    <span id="readthis" style="font-size: 8pt; font-color: red;" onmouseover="show_tips(theTips1)" onmouseout="hide_tips(theTips1)">Guidance Notes</span>
    </div>
    Interestingly the "Guidance Notes" does not show up in red,
    so something is pretty badly wrong, but I can not see what
    it is

    Also the mouseover/mouseout don't do anything.

    Can anyone see what I've done wrong ?
    thanks
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    without testing I'd say, line #1: between attribute and value there shouldn't be any whitespace characters; line #18: put the string values in quotation marks, otherwise they're not recognized as strings.

    regards

    Comment

    • jeddiki
      Contributor
      • Jan 2009
      • 290

      #3
      Thanks for reply
      Do you mean:

      at # 1 class = "tips" should be class="tips" ?

      and

      #18 "show_tips(theT ips1)" should be "show_tips('the Tips1')" ?

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        yes, that's what I meant.

        Comment

        • jeddiki
          Contributor
          • Jan 2009
          • 290

          #5
          Thanks,
          I tried it, but no change :(

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            argh.... looked once again. there is no CSS property "font-color" (you may use "color" instead). stupid I didn't see that at once.

            as for the Javascript, tried it myself and it worked. maybe the error panel can give you some hints.

            Comment

            • jeddiki
              Contributor
              • Jan 2009
              • 290

              #7
              no CSS property "font-color"
              - opps!! sorry silly typo.

              "maybe the error panel can give you some hints. "
              where's that error panel then ?

              Comment

              • Dormilich
                Recognized Expert Expert
                • Aug 2008
                • 8694

                #8
                Originally posted by jeddiki
                "maybe the error panel can give you some hints. "
                where's that error panel then ?
                in Firefox it's located under "Extras" or cmd+shift+j (problem is, I run the german version on a Mac, so I don't know whether the keyboard shortcut is correct or the names are as I said)

                Comment

                • jeddiki
                  Contributor
                  • Jan 2009
                  • 290

                  #9
                  What's Firefox ?

                  Is it something like Internet Explorer
                  - a cheaper version maybe ???

                  ha ha ha just joking !

                  The error console is under the Tools tab - thanks
                  it does show an error :)

                  Comment

                  • Dormilich
                    Recognized Expert Expert
                    • Aug 2008
                    • 8694

                    #10
                    you may want to use the Firebug plugin, just awesome when it comes to debugging and coding.

                    Comment

                    • jeddiki
                      Contributor
                      • Jan 2009
                      • 290

                      #11
                      I will look into that,

                      But the error says that start, show_tips, hide_tips are not defined.

                      Its as if it isn't picking up the external.js

                      Is this OK:

                      Code:
                      <script type="text/javascript" src="external.js"> 
                      </script>
                      Did I leave something out ?
                      Last edited by Dormilich; Jan 15 '09, 01:42 PM. Reason: added [code] tags

                      Comment

                      • Dormilich
                        Recognized Expert Expert
                        • Aug 2008
                        • 8694

                        #12
                        is the file correctly referenced (i.e. is it in the same directory as the html file)?

                        Comment

                        • jeddiki
                          Contributor
                          • Jan 2009
                          • 290

                          #13
                          It is in the same directory, so should work

                          Maybe you could see if you get the same js error ?

                          The only problem is, this is part of a members page so I can not give a simple link.

                          Here is the url

                          Guru Free Stuff.

                          From there you will need to sign in:

                          member id "Fred"
                          pw: "pass004"

                          then hit the "Contorl Panel" in the menu

                          then click "Add a New Product"

                          That is the page I am taling about - you will see green tips in the middle of the page - these should be invisable and only show when mouse in over the "Guidance Notes"

                          If you can take a quick look, I'd much appreciate it as I can't understand why the js is not working

                          Comment

                          • Dormilich
                            Recognized Expert Expert
                            • Aug 2008
                            • 8694

                            #14
                            Originally posted by jeddiki
                            Maybe you could see if you get the same js error ?
                            sorry, no js errors for me, Firebug confirms js loading too. although you have some CSS related errors (it's style.backgroun dColor)

                            Comment

                            • acoder
                              Recognized Expert MVP
                              • Nov 2006
                              • 16032

                              #15
                              start() is not defined because document.getEle mentById(theTip s1) should be
                              Code:
                              document.getElementById("theTips1")..

                              Comment

                              Working...