Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    New Coder
    Join Date
    Oct 2005
    Location
    Camino, California.
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hopefully an easy question about onClick links.

    Is there a way to have a link that executes a function onClick, but when you mouse over your cursor turns to the pointer finger icon like a regular html link? I have the link system and everything working fine, but people are getting confused because the words don't look like links but they are.

    Thanks everyone!
    Currently designing and coding an entire RPG in VB

  • #2
    New Coder
    Join Date
    Oct 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <img src="image.bmp" 
    onmousedown="function here"
    onmouseover="function here">
    I had a script for cursors, I'll go find it. be right back

  • #3
    New Coder
    Join Date
    Oct 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OK replace function here in the onmouseover event for your img with this:
    Code:
    cursor: url(hand)
    I think. If that doesn't work try this:
    Code:
    cursor: (hand)
    and if those don't work, try adding .cur after hand.
    Hope this helps
    -littlehank

  • #4
    New Coder
    Join Date
    Oct 2005
    Location
    Camino, California.
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'd hate to say it, but I tried all four of those combinations and it didn't work. Also, I'm not using an image, but that shouldn't matter with the cursor.
    Currently designing and coding an entire RPG in VB

  • #5
    New Coder
    Join Date
    Oct 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I found this. maybe if we changed the body or ahover to img or something like that, whatever you're using, it would work...
    Code:
    <style>
    body { cursor: url(something.cur); }
    a:hover { cursor: url(something.cur); }
    </style>
    Try it.
    -littlehank

  • #6
    New Coder
    Join Date
    Oct 2005
    Location
    Camino, California.
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    and where you write:

    something.cur

    what should I write?
    Currently designing and coding an entire RPG in VB

  • #7
    New Coder
    Join Date
    Oct 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    either:
    a - url of a custom cursor
    b - hand.cur or whatever the default link cursor is named.

  • #8
    New Coder
    Join Date
    Oct 2005
    Location
    Camino, California.
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Wait, I think you may have misunderstood what I'm doing. I'm just making a simple text link:

    <a href onClick="justleave()">Just Leave </a>

    <script>
    function justleave() {

    top.document.getElementById("frame1").src="frames/5.htm"

    }
    </script>
    The link and everything works fine, but when you mouse over it, the cursor is just your ordinary cursor like when you mouse over this text. People can't tell it's a link.
    Currently designing and coding an entire RPG in VB

  • #9
    New Coder
    Join Date
    Oct 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i don't get it

  • #10
    Regular Coder
    Join Date
    Sep 2005
    Posts
    535
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Took me a while to find the error (such a small thing to overlook)... just have href point somewhere (eg "<a href='#' onClick='myFunction()'>Click Here</a>") Note: href='#' points to itself while href="www.codingforums.com" will point to an actual url.

  • #11
    New Coder
    Join Date
    Oct 2005
    Location
    Camino, California.
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmmmm. That may have worked. I was able to figure it out with the help of fci, however. See:

    <a href="" onClick="gotoplace(); return false;"> Go </a>

    The "return false;" tag renders the href potion of the link useless.
    Currently designing and coding an entire RPG in VB

  • #12
    New Coder
    Join Date
    Nov 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    rendering href useless...

    Hi: I am using code similar to that below for calling a javascript function from a link.

    I am able to call my function in the head and also from an input button. So..the function works well. But the link is eluding me (and of course that is what I need...). I can't seem to render href useless... I've tried:

    <a href="" onClick="gotoplace(); return false;"> Go </a>
    <a href="#" onClick="gotoplace(); return false;"> Go </a>
    <a href="..." onClick="gotoplace(); return false;"> Go </a>

    The above solutions seem to work for many of the people on this forum, but not for me (my function does work)...I am wondering - I've got windows XP. Could this be the problem?

    thanks to anyone who can offer any help...

    karen99

  • #13
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    What is your function, you could have an error in it.

  • #14
    New Coder
    Join Date
    Nov 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    here is my function

    To Aerospace:

    thanks for your reply....here is my function. I know it works, as i can call it elsewhere and open the file. In addition, I just tried this on a machine with windows 2000 (href=""), and it took me to the directory where the file is...

    <script language="Javascript" type="text/javascript">
    function startXL(strFile)
    {
    var myApp = new ActiveXObject("Excel.Application");
    if (myApp != null)
    {
    myApp.visible = true;
    myApp.workbooks.open("d:\test.xls");
    }
    }
    </script>

    also tried this script:
    <script language="Javascript" type="text/javascript">
    function startXL(strFile)
    {
    var myApp = new ActiveXObject("Excel.Application");
    if (myApp != null)
    {
    myApp.visible = true;
    myApp.workbooks.open("d:\\test.xls");
    }
    }
    </script>




    and for your convenience: the link code I've tried:

    <a href="" onClick="startXL(); return false" style="cursor: pointer;">test</a></li>

    <a href="#" onClick="startXL(); return false" style="cursor: pointer;">test</a></li>

    <a href="..." onClick="startXL(); return false;" style="cursor: pointer;">test</a></li>

  • #15
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Using those links they all work fine for me. I'm not sure why they don't work for you. What are the specs of your system? Is this being ran locally like on an intranet?


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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