www.webdeveloper.com
Results 1 to 12 of 12

Thread: no hand(s)!

  1. #1
    Join Date
    Nov 2008
    Posts
    20

    no hand(s)!

    Hi, I'm new to javascript and such and a bit of a trial and error artist. I were trying to make a image gallery and It was no problem, the problem however are that the pointer doesnt turn in to a hand when over an clickable image object.

    The code works fine, soo far, in opera, explorer and firefox.

    please give me your thoughts on this hand problem, the code are in it's early stage so it's far from finished......

    here's the code:

    <html>
    <head><link href="exp.css" rel="stylesheet" type="text/css"></head>
    <body>


    <div class="box2">
    <img
    name="jsbutton" src="bild1.jpg" border="0"
    alt="javascript button">

    </div>
    <div class="box1>

    <a href="#">

    <img src="bild1.jpg" border="0"
    onClick="down()"
    alt="javascript button">

    <img src="bild2.jpg" border="0"
    onClick="handleMDown()"
    alt="javascript button"></a>

    </div>


    <script type="text/javascript">

    <!--


    function handleMDown()
    {

    document.images["jsbutton"].src= "bild2.jpg";

    }
    function down()
    {

    document.images["jsbutton"].src= "bild1.jpg";

    }


    //-->
    </script>


    </body>
    </html>

    I guess that you wont be needing the css, but here it is:


    .box1 {width: 450px; padding: 0px; float:
    right; position: absolute; left:450px; top:0px;
    background-color:transparent; }

    .box2{width: 450px; padding: 0px; float:right; position: absolute; left: 600px; top: 200px;}

    thanks

    Lars

  2. #2
    Join Date
    Feb 2006
    Posts
    2,927
    in your css add a img{cursor:pointer}

  3. #3
    Join Date
    Nov 2008
    Posts
    20

    thanks....

    Quote Originally Posted by mrhoo View Post
    in your css add a img{cursorointer}
    Thanks, It didn't work and I really dont know why, but i put it in the HTML-code <span style="cursorointer"> and then it worked fine, so thanks! If anyone has got a suggestion on why it didnt work in a separate CSS-file or a better solution on solving the problem, just post!

    Please visit my homepage and listen to some nice music, you'll like it!

    Lars

  4. #4
    Join Date
    Nov 2008
    Posts
    20

    c(ss)ommunication

    I cant get the images inside <a href="#"></a> to communicate with the external css file, I have to put it inside the HTML-code, as seen in the code below. Maybe this has got something to do with the javascriptcode.

    the reason for using
    HTML Code:
    cursor:pointer
    at all, are that the pointer doesnt work hovering over the <a href images, but with this code it does,(see post: no hands) however, it would be nice to be able to rezize images and such from the css-file.

    I'm new to this, so it's probably a simple thing that I have overseen.

    <html>
    <head></head>
    <body><link href="exp.css" rel="stylesheet" type="text/css">


    <div class="box2">
    <img
    name="jsbutton" src="bild1.jpg" border="0"
    alt="javascript button">
    </div>

    <div class="box1>


    <a href="#">

    <span style="cursorointer">

    <img src="bild1.jpg" border="0"
    onClick="down()"
    alt="javascript button">

    <img src="bild2.jpg" border="0"
    onClick="handleMDown()"
    alt="javascript button"></a>

    </div>


    <script type="text/javascript">

    <!--


    function handleMDown()
    {

    document.images["jsbutton"].src= "bild2.jpg";

    }
    function down()
    {

    document.images["jsbutton"].src= "bild1.jpg";

    }


    //-->
    </script>


    </body>
    </html>

  5. #5
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    The style="cursor: pointer" is not required. The anchor does this naturally.
    Please post the complete documents.

    Do not start a new thread; be patient or 'bump' you post if necessary.
    At least 98% of internet users' DNA is identical to that of chimpanzees

  6. #6
    Join Date
    Nov 2008
    Posts
    20

    Read the thread!

    Quote Originally Posted by Fang View Post
    The style="cursor: pointer" is not required. The anchor does this naturally.
    Please post the complete documents.

    Do not start a new thread; be patient or 'bump' you post if necessary.
    I know that it's SUPOSED to do that, but the problem were that it DIDNT and that problem are solved by using the cursor: pointer.....

    Now the reason for starting a new thread were that it were a NEW problem that has no natural connection to the 'no hands' problem.

    Please READ THE THREAD before re-directing!

  7. #7
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    I know that it's SUPOSED to do that, but the problem were that it DIDNT and that problem are solved by using the cursor: pointer.....
    This gives the pointer:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    
    </head>
    <body>
    <a href="#">
        <img src="bild1.jpg" border="0" onclick="down()" alt="javascript button">
        <img src="bild2.jpg" border="0" onclick="handleMDown()" alt="javascript button">
    </a>
    </body>
    </html>
    Now the reason for starting a new thread were that it were a NEW problem that has no natural connection to the 'no hands' problem.
    Post the full documents. We need to see the css and JavaScript.
    Please READ THE THREAD before re-directing!
    There is no need to shout.
    At least 98% of internet users' DNA is identical to that of chimpanzees

  8. #8
    Join Date
    Nov 2008
    Posts
    20
    Quote Originally Posted by Fang View Post
    This gives the pointer:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    
    </head>
    <body>
    <a href="#">
        <img src="bild1.jpg" border="0" onclick="down()" alt="javascript button">
        <img src="bild2.jpg" border="0" onclick="handleMDown()" alt="javascript button">
    </a>
    </body>
    </html>
    Post the full documents. We need to see the css and JavaScript.
    There is no need to shout.
    Sorry, but there's no reason to move other peoples stuff around without reading it. The javascript are up there in the HTML.

    Your code only work in firefox, not explorer, not if you use it within my code with the javascript at least.

  9. #9
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    The code works in IE6 and IE7

    The image swap works correctly:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript">
    function handleMDown()
    {
    document.images["jsbutton"].src= "bild2.jpg";
    }
    
    function down()
    {
    document.images["jsbutton"].src= "bild1.jpg";
    }
    </script>
    </head>
    <body>
    <div class="box2">
    	<img name="jsbutton" src="bild1.jpg" border="0" alt="javascript button">
    </div>
    
    <div class="box2">
    <a href="#">
        <img src="bild1.jpg" border="0" onclick="down()" alt="javascript button">
        <img src="bild2.jpg" border="0" onclick="handleMDown()" alt="javascript button">
    </a>
    </div>
    </body>
    </html>
    At least 98% of internet users' DNA is identical to that of chimpanzees

  10. #10
    Join Date
    Nov 2008
    Posts
    20

    Thumbs up thanks......

    THANK YOU VERY MUCH FUNG! Sorry for being a arse, I should make a rule that I dont do anything before I get a cup of coffee..... sorry again. Please visit my page: www.larsbylund.com and listen to my nice music and I think you'll forgive me....

  11. #11
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    No problem.
    At least 98% of internet users' DNA is identical to that of chimpanzees

  12. #12
    Join Date
    Nov 2008
    Posts
    20
    Quote Originally Posted by Fang View Post
    No problem.
    look, I tried it on my textile page and it works so fine! http://larsbylund.com/textile1.htm

    Now I'll just have to improve it a bit, and I can use it on my other pages to! jippie!!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles