CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   PHP (http://www.codingforums.com/forumdisplay.php?f=6)
-   -   Page Preview code (http://www.codingforums.com/showthread.php?t=285265)

mharrison 01-04-2013 01:12 PM

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!

mlseim 01-04-2013 01:33 PM

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>"


.

AndrewGSW 01-04-2013 01:34 PM

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.

mlseim 01-04-2013 01:35 PM

Andrew is correct ... maybe AJAX (some PHP/JQuery) would be better.
I don't have an example to show.

mharrison 01-04-2013 01:49 PM

Quote:

Originally Posted by mlseim (Post 1304013)
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

mlseim 01-04-2013 11:14 PM

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>"


.


All times are GMT +1. The time now is 05:23 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.