关于 phpmysql 中的 MouseOver doTooltip

发布于 2024-08-18 17:14:07 字数 940 浏览 11 评论 0 原文

您好,请帮助修复此代码,我使用 TITLE

在此代码中,但它不起作用

    <? 
    $sql = "select * from wallpaper order by wallpaperid desc limit 20"; 
$result = mysql_query($sql, $db) or die(mysql_error()); 
if(mysql_num_rows($result)) { 
while($myrow = mysql_fetch_array($result)) { 
   $title = substr($myrow['title'] ,0,31);
   $wurl = ereg_replace(" ", "-", $myrow['title']);
   $html = '<dt><a href="%s-%s.html" onMouseOver="doTooltip(event,\'.$siteurl/wallpapers/thumbs/$wallpapername_$wallpaperid.jpg.\',"Image TITLE")" onMouseOut="hideTip()">%s..</a></dt>';
printf($html, $wurl, $myrow["wallpaperid"], $myrow["wallpapername"], $myrow["title"], $category);
} } 

?>

请有人帮我解决这个问题 第二个代码在mouseOver提示上不起作用

HI Please help to fix this code , i use <a href="http://example.com/index.html" onMouseOver="doTooltip(event,'http://example.com/image_6.06.jpg','Image TITLE')" onMouseOut="hideTip()" title="in TITLE">TITLE</a>

in this code but its not work

    <? 
    $sql = "select * from wallpaper order by wallpaperid desc limit 20"; 
$result = mysql_query($sql, $db) or die(mysql_error()); 
if(mysql_num_rows($result)) { 
while($myrow = mysql_fetch_array($result)) { 
   $title = substr($myrow['title'] ,0,31);
   $wurl = ereg_replace(" ", "-", $myrow['title']);
   $html = '<dt><a href="%s-%s.html" onMouseOver="doTooltip(event,\'.$siteurl/wallpapers/thumbs/$wallpapername_$wallpaperid.jpg.\',"Image TITLE")" onMouseOut="hideTip()">%s..</a></dt>';
printf($html, $wurl, $myrow["wallpaperid"], $myrow["wallpapername"], $myrow["title"], $category);
} } 

?>

plsease someone help me to fix this
Second code not work onmouseOver TIP

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦行七里 2024-08-25 17:14:07

首先,这纯粹是一个前端(即Javascript/HTML)问题。它与 PHP 无关。您实际上没有提供足够的信息来帮助查明问题。查看“doTooltip”和“hideTip”javascript 函数会更有帮助。

也就是说,我注意到您尝试在链接字符串中使用变量 $siteurl$wallpapername$wallpaperid 变量。不能在以 '(单引号)分隔的字符串中使用 PHP 变量。

试试这个:

$html = '<dt><a href="%s-%s.html" onMouseOver="doTooltip(event,\''.$siteurl.'/wallpapers/thumbs/'.$wallpapername.'_'.$wallpaperid.'.jpg.\',"Image TITLE")" onMouseOut="hideTip()">%s..</a></dt>';

但我怀疑这与您实际想要解决的问题无关。我建议你修改你的问题。这次省略 PHP,仅显示脚本生成的最终输出。祝你好运!

First of all, this is purely a front-end (that is, Javascript/HTML) problem. It has nothing to do with PHP. You haven't actually provided enough information to help pinpoint the issue. It would be much more helpful to see your "doTooltip" and "hideTip" javascript functions.

That said, I notice that you're attempting to use variables $siteurl, $wallpapername, and $wallpaperid variables in your link string. You cannot use PHP variables in a string delimited with ' (single quotes).

Try this:

$html = '<dt><a href="%s-%s.html" onMouseOver="doTooltip(event,\''.$siteurl.'/wallpapers/thumbs/'.$wallpapername.'_'.$wallpaperid.'.jpg.\',"Image TITLE")" onMouseOut="hideTip()">%s..</a></dt>';

But I suspect that this isn't related to the problem you're actually trying to solve. I'd recommend that you revise your question. Leave out the PHP this time and only show the final output generated by your script. Good luck!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文