我想要的效果是数据库QUERY出一排文字,点击文字打开a href="index.php?site=' .$site. ',鼠标移动到文字上显示该文字相应的$picture到指定的DIV(解释带图片和超链);鼠标移动到下一个文字上,DIV里替换成新文字的$picture。index.php代码$html .= '<a href="index.php?site=' .$site. '" onmouseover="document. getElementById(\''.title.'\').innerHTML=\''.$picture.'\'" target="_self">';
$picture="<a href=\"". $link . "\"><div style=\"float:left;\">".$pic."</div><div style=\"float:left;\">".$title."</div></a>";
上面的代码写在一个FUNCTION里面。下面的代码QUERY出文字并监听上面的FUNCTION。继续index.php代码<div id="fptv3h">
<?php
$result = mysql_query("SELECT url FROM feed ORDER by 'num' DESC");
while ($row = mysql_fetch_array($result)) {
echo urlmethod::list(array("".$row["url"].""));
} ?>
</div>
<div class="fullcontent" id="thistitle"> </div>
打开index.php时,<div class="fullcontent" id="thistitle">为空,鼠标移动后才显示文字的$picture。
点击a href="index.php?site=' .$site. '后记住该链接的文字$picture显示在该DIV里面。求代码更正,并补全“点击a href="index.php?site=' .$site. '后记住该链接的文字$picture显示在该DIV里面”的功能。谢谢。
PS:网上搜索后没找到相关的innerHTML= php string的教程,特此求教。
$picture="<a href=\"". $link . "\"><div style=\"float:left;\">".$pic."</div><div style=\"float:left;\">".$title."</div></a>";
上面的代码写在一个FUNCTION里面。下面的代码QUERY出文字并监听上面的FUNCTION。继续index.php代码<div id="fptv3h">
<?php
$result = mysql_query("SELECT url FROM feed ORDER by 'num' DESC");
while ($row = mysql_fetch_array($result)) {
echo urlmethod::list(array("".$row["url"].""));
} ?>
</div>
<div class="fullcontent" id="thistitle"> </div>
打开index.php时,<div class="fullcontent" id="thistitle">为空,鼠标移动后才显示文字的$picture。
点击a href="index.php?site=' .$site. '后记住该链接的文字$picture显示在该DIV里面。求代码更正,并补全“点击a href="index.php?site=' .$site. '后记住该链接的文字$picture显示在该DIV里面”的功能。谢谢。
PS:网上搜索后没找到相关的innerHTML= php string的教程,特此求教。
$picture="<a href=\"". $link . "\"><div style=\‘float:left;\’>".$pic."</div><div style=\‘float:left;\’>".$title."</div></a>";源文件显示:
<a href="index.php?site=baidu.com" target="_self" onmouseover="document.getElementById('title').innerHTML='<a href="http://hi.baidu.com/pets_yue/album/item/4b89778ad59e73eefc1f1057.html"><img width='540px' height='428px' src="http://hiphotos.baidu.com/%BE%AB%B7%D6%B5%C4%D7%CF/pic/item/bfec0703cdfe623c728da57b.jpg" />100621 mbc举办dmc中心开幕仪式表演新闻图(9)</a>'">新闻.jpg</a>
难道innerHTML里面不能使用超链接地址?
$html .= <<< HTML
<a href="index.php?site=$site" target="_self" onmouseover="document.getElementById('$title').innerHTML='$picture'">
HTML;
$picture = <<< HTML
<a href="$link"><div style='float:left;'>$pic</div><div style='float:left;'>$title</div></a>
HTML;
<a href="$link"><div style='float:left;'>$pic</div><div style='float:left;'>$title</div></a>
HTML;
Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in E:\www\12\index.php on line 566
566行是代码最后一段有PHP符号<? ?>的地方。
$html .= 上一行的 $html .= $item->get_date还是黑色的。