problem with onmousover

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • m9817232
    New Member
    • Mar 2008
    • 8

    problem with onmousover

    hello,

    onmouseover won't work on my website.
    it's working in a simple html document, but not in the advanced one..

    both files (including pictures and css) can be found at:
    http://depositfiles.co m/files/4440764

    can anybody help me out?
    thx in advance!

    michael
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    please post a relevant non working example here ... i'm not sure that anybody likes to search through your code and locate the problem for you ...

    do you get any errors? how do you apply the handlers etc.?

    kind regards

    Comment

    • m9817232
      New Member
      • Mar 2008
      • 8

      #3
      Originally posted by gits
      please post a relevant non working example here ... i'm not sure that anybody likes to search through your code and locate the problem for you ...

      do you get any errors? how do you apply the handlers etc.?

      kind regards
      the link in my post contains a non workiing example.
      the problem is also, that i dont know the origin of the problem (wether it is the javascript code or the css).. i'm a newbie..
      my apologies..

      Comment

      • vee10
        New Member
        • Oct 2006
        • 141

        #4
        Hi,

        onmouse over event is working in that example
        check it once on mouse over to the number 1 to 6 the image is getting changed
        if this is not the behaviour what should be the behaviour



        Originally posted by m9817232
        the link in my post contains a non workiing example.
        the problem is also, that i dont know the origin of the problem (wether it is the javascript code or the css).. i'm a newbie..
        my apologies..

        Comment

        • gits
          Recognized Expert Moderator Expert
          • May 2007
          • 5390

          #5
          Originally posted by m9817232
          the link in my post contains a non workiing example.
          the problem is also, that i dont know the origin of the problem (wether it is the javascript code or the css).. i'm a newbie..
          my apologies..
          to provide a link to a zip-file that may contain everything does not provide any help since it is just more to do for people that probably would help you when you just had posted your code in the thread. even when you are a 'newbie' you should be able to locate a problem in your code ... and have an idea what might be wrong ... except you just copied/borrowed code from other pages ... and expect that it would work ...

          kind regards

          Comment

          • m9817232
            New Member
            • Mar 2008
            • 8

            #6
            Originally posted by vee10
            Hi,

            onmouse over event is working in that example
            check it once on mouse over to the number 1 to 6 the image is getting changed
            if this is not the behaviour what should be the behaviour
            are you sure you tried the index.htm ?
            the "index simple working.htm" is indeed working , it's the other .htm with coloured background that contains a problem. on the picture (on the left bottom cornerp) you'll see 6 numbers which have to be hovered on....

            Comment

            • hsriat
              Recognized Expert Top Contributor
              • Jan 2008
              • 1653

              #7
              Originally posted by m9817232
              hello,

              onmouseover won't work on my website.
              it's working in a simple html document, but not in the advanced one..

              both files (including pictures and css) can be found at:
              DepositFiles provides you with a legitimate technical solution, which enables you to upload, store, access and download text, software, scripts, images, sounds, videos, animations and any other materials in form of one or several electronic files.


              can anybody help me out?
              thx in advance!

              michael
              The picture being displayed is not from img tab, but the background image.

              So remove the img tag (with name='Model') for image and in the onmouseover event of each link, write this..
              [code=javascript]document.getEle mentById('leftc ol').background Image = "url('image s/1.jpg')";[/code]

              1.jpg, 2.jpg... so on

              Regards,
              Harpreet

              Comment

              • m9817232
                New Member
                • Mar 2008
                • 8

                #8
                Thx for your help!!..
                now i know that the image was a background image defined in css.. so the one in html was obsolete.. that was an important clue!

                however, I did all you suggested, but still it won't work..
                this is what i got:
                .....
                <div id="leftcol">
                <h2><span>Optio nal Header</span></h2>

                <div id="nav">

                <b><span><a href="#" Onmouseover="do cument.getEleme ntById('leftcol ').backgroundIm age = "url('image s/1.jpg')";">1</a></span></b>
                <b><span><a href="#" Onmouseover="do cument.getEleme ntById('leftcol ').backgroundIm age = "url('image s/2.jpg')";">2</a></span></b>
                <b><span><a href="#" Onmouseover="do cument.getEleme ntById('leftcol ').backgroundIm age = "url('image s/3.jpg')";">3</a></span></b>
                <b><span><a href="#" Onmouseover="do cument.getEleme ntById('leftcol ').backgroundIm age = "url('image s/4.jpg')";">4</a></span></b>
                <b><span><a href="#" Onmouseover="do cument.getEleme ntById('leftcol ').backgroundIm age = "url('image s/5.jpg')";">5</a></span></b>
                <b><span><a href="#" Onmouseover="do cument.getEleme ntById('leftcol ').backgroundIm age = "url('image s/6.jpg')";">6</a></span></b>

                </div>
                </div>

                ......

                Comment

                • vee10
                  New Member
                  • Oct 2006
                  • 141

                  #9
                  Hi,

                  i have seen the indexsimplework ing.htm not index.htm

                  this may solve ur problem
                  Code:
                  div id="leftcol">
                  
                  			<h2><span>Optional Header</span></h2>
                  
                  			
                  		
                  <span>
                  <img src="images/main_img.jpg" id="foto"  width="300" height="450" alt="foto" />
                  </span>
                  	
                  
                  <script type="text/javascript">
                  function changeimg(image)
                  {
                  document.getElementById('leftcol').style.backgroundImage  ="url('images/" + image + ".jpg')";
                  
                  }
                  
                  </script>
                  
                  			<div id="nav">			
                  			<b><span><a href="#" onmouseover="changeimg('1')">1</a></span></b>
                  			<b><span><a href="#" onmouseover="changeimg('2')">2</a></span></b>			
                  			<b><span><a href="#" onmouseover="changeimg('3')">3</a></span></b>
                  			<b><span><a href="#" onmouseover="changeimg('4')">4</a></span></b>
                  			<b><span><a href="#" onmouseover="changeimg('5')">5</a></span></b>
                  			<b><span><a href="#" onmouseover="changeimg('6')">6</a></span></b>
                  </div>
                  </div>

                  Originally posted by m9817232
                  Thx for your help!!..
                  now i know that the image was a background image defined in css.. so the one in html was obsolete.. that was an important clue!

                  however, I did all you suggested, but still it won't work..
                  this is what i got:
                  .....
                  <div id="leftcol">
                  <h2><span>Optio nal Header</span></h2>

                  <div id="nav">

                  <b><span><a href="#" Onmouseover="do cument.getEleme ntById('leftcol ').backgroundIm age = "url('image s/1.jpg')";">1</a></span></b>
                  <b><span><a href="#" Onmouseover="do cument.getEleme ntById('leftcol ').backgroundIm age = "url('image s/2.jpg')";">2</a></span></b>
                  <b><span><a href="#" Onmouseover="do cument.getEleme ntById('leftcol ').backgroundIm age = "url('image s/3.jpg')";">3</a></span></b>
                  <b><span><a href="#" Onmouseover="do cument.getEleme ntById('leftcol ').backgroundIm age = "url('image s/4.jpg')";">4</a></span></b>
                  <b><span><a href="#" Onmouseover="do cument.getEleme ntById('leftcol ').backgroundIm age = "url('image s/5.jpg')";">5</a></span></b>
                  <b><span><a href="#" Onmouseover="do cument.getEleme ntById('leftcol ').backgroundIm age = "url('image s/6.jpg')";">6</a></span></b>

                  </div>
                  </div>

                  ......

                  Comment

                  • m9817232
                    New Member
                    • Mar 2008
                    • 8

                    #10
                    thx r helping me out, guys!

                    Comment

                    Working...