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.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Dec 2012
    Posts
    54
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Page Preview code

    I found this website:
    http://psoug.org/snippet/Javascript-...-Hover_216.htm

    Which contains the javascript code for having a page preview open up when you mouse over a link.

    Right now I have the following being echoed to create a link from two fields in my database:

    PHP Code:
    echo "<td><a href=\"".$row['lnktxt']."\" target=_blank>".$row['dsptxt']."</a></td>"
    I'm having trouble figuring out how I can merge the code I have with the code from the website:

    Code:
    <a href="#" onMouseOver="toggleDiv('div1',1,'http://www.google.com')" onMouseOut="toggleDiv('div1',0,'http://www.google.com')">Link 1!</a>
    Can anyone help me figure out how I can do this, or even if I can be done?

    Thanks!
    Last edited by mharrison; 01-04-2013 at 01:23 PM.

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,456
    Thanks
    8
    Thanked 1,084 Times in 1,075 Posts
    I'll take a shot at it ...

    PHP Code:
    echo "<td><a href=\"".$row['lnktxt']."\" target=\"_blank\" onMouseOver=\"toggleDiv('div1',1,'".$row['lnktxt']."')\" onMouseOut=\"toggleDiv('div1',0,'".$row['lnktxt']."')\" >".$row['dsptxt']."</a></td>"

    .

  • #3
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    That code is ancient. Even though it states it was last edited in 2009, it will have been many years before that!

    [language="JavaScript", capitalised TAGS, document.layers are the clues.]

    I suggest that you find more recent code before attempting to merge it with yours.
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,456
    Thanks
    8
    Thanked 1,084 Times in 1,075 Posts
    Andrew is correct ... maybe AJAX (some PHP/JQuery) would be better.
    I don't have an example to show.

  • #5
    New Coder
    Join Date
    Dec 2012
    Posts
    54
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mlseim View Post
    Andrew is correct ... maybe AJAX (some PHP/JQuery) would be better.
    I don't have an example to show.
    Ancient it may be, but it is the best example I have found so far that doesn't completely go over my head or require me to create image snapshots of all 21+ thousand links I have in my database.

    Thanks anyways, I'll keep looking.

    FYI, thanks for taking a shot at merging the code. When I uploaded I ended up with the following error:
    Code:
    Parse error: syntax error, unexpected 'div1' (T_STRING), expecting ',' or ';' in /homepages

  • #6
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,456
    Thanks
    8
    Thanked 1,084 Times in 1,075 Posts
    Try this:

    PHP Code:

    echo "<td><a href=\"{$row['lnktxt']}\" target=\"_blank\" onMouseOver=\"toggleDiv('div1',1,'{$row['lnktxt']}')\" onMouseOut=\"toggleDiv('div1',0,'{$row['lnktxt']}')\" >{$row['dsptxt']}</a></td>"

    .


  •  

    Posting Permissions

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