关于 phpmysql 中的 MouseOver doTooltip
您好,请帮助修复此代码,我使用 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提示上不起作用
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,这纯粹是一个前端(即Javascript/HTML)问题。它与 PHP 无关。您实际上没有提供足够的信息来帮助查明问题。查看“doTooltip”和“hideTip”javascript 函数会更有帮助。
也就是说,我注意到您尝试在链接字符串中使用变量 $siteurl、$wallpapername 和 $wallpaperid 变量。不能在以 '(单引号)分隔的字符串中使用 PHP 变量。
试试这个:
但我怀疑这与您实际想要解决的问题无关。我建议你修改你的问题。这次省略 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:
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!