php读取mysql,输出的标题怎么做超链接,像下面用js做超链接,我是新手
<scripttype="text/javascript">functionconf(){window.location.href="ou.php";}</script>...
<script type="text/javascript">
function conf() {
window.location.href="ou.php";
}
</script>
<a href="javascript:void(0);" onclick="javascript:conf('ou.php'); return false;" style="color:#000;">跳转</a> 展开
function conf() {
window.location.href="ou.php";
}
</script>
<a href="javascript:void(0);" onclick="javascript:conf('ou.php'); return false;" style="color:#000;">跳转</a> 展开
3个回答
展开全部
while($ROW = mysql_fetch_assoc($rzt)){
echo "<a href=\"javascript:void($ROW[id]);\" style=\"color:#000;\">$ROW['title']</a>";
}
<script type="text/javascript">
function conf(id) {
window.location.href="ou.php?id="+id;
}
</script>
-----------------------------------------------------------
ou.php
-----------------------------------------------------------
$id = $_GET['id'] ? intval($_GET['id']) : 0;
if($id == 0){
header("Location:list.php");
}else{
$sql = "select `title`,`content`,`create_time` from test_table where id = '$id'";
$rzt = mysql_query( $sql );
$ROW = mysql_fetch_assoc( $rzt );
$content = $ROW['content'];
$title = $ROW['title'];
$ctime = $ROW['create_time'];
echo "题目是:$title<br>";
echo "内容是:$content<br>";
echo "创建时间是:$ctime";
}
echo "<a href=\"javascript:void($ROW[id]);\" style=\"color:#000;\">$ROW['title']</a>";
}
<script type="text/javascript">
function conf(id) {
window.location.href="ou.php?id="+id;
}
</script>
-----------------------------------------------------------
ou.php
-----------------------------------------------------------
$id = $_GET['id'] ? intval($_GET['id']) : 0;
if($id == 0){
header("Location:list.php");
}else{
$sql = "select `title`,`content`,`create_time` from test_table where id = '$id'";
$rzt = mysql_query( $sql );
$ROW = mysql_fetch_assoc( $rzt );
$content = $ROW['content'];
$title = $ROW['title'];
$ctime = $ROW['create_time'];
echo "题目是:$title<br>";
echo "内容是:$content<br>";
echo "创建时间是:$ctime";
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询