求大神!为什么点击详情页没有反应 奇怪的是把代码一边就可以弹出对话框了,为什么
<input type="button" value="详情" class="btn" onclick="showDetail(<?php echo $row['id'];?>, <?php echo $row['pName'];?>)">
这是点击详情页的一段话 如果把PName改为id 就可以成功弹出详情页
但是只有onclick="showDetail(<?php echo $row['id'];?>, <?php echo $row['pName'];?>)"后面的pname改为数字字符串就可以弹出 如果像pname中里面有英文就不能弹出详情页 纠结了三个小时 实在不知道哪里有问题。。另外附上全部代码:求大神帮忙看一下
<?php
require_once '../include.php';
checkLogined ();
// 得到所有商品
$pagesize = 2;
$page = $_REQUEST ["page"] ? ( int ) $_REQUEST ["page"] : 1;
$rows = getAllProByPage ( $page, $Admininfo );
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>-.-</title>
<link rel="stylesheet" href="styles/backstage.css">
<link rel="stylesheet"
href="scripts/jquery-ui/css/ui-lightness/jquery-ui-1.10.4.custom.css" />
<script src="scripts/jquery-ui/js/jquery-1.10.2.js"></script>
<script src="scripts/jquery-ui/js/jquery-ui-1.10.4.custom.js"></script>
<script src="scripts/jquery-ui/js/jquery-ui-1.10.4.custom.min.js"></script>
</head>
<script type="text/javascript">
function showDetail(id,t){
$("#showDetail"+id).dialog({
height:"auto",
width: "auto",
position: {my: "center", at: "center", collision:"fit"},
modal:false,//是否模式对话框
draggable:true,//是否允许拖拽
resizable:true,//是否允许拖动
title:"商品名称:"+t,//对话框标题
show:"slide",
hide:"explode"
});
}
function addPro(){
window.location='addPro.php';
}
function editPro(id){
window.location='editPro.php?id='+id;
}
function delPro(id){
if(window.confirm("您确认要删除嘛?添加一次不易,且删且珍惜!")){
window.location="doAdminAction.php?act=delPro&id="+id;
}
}
function search(){
if(event.keyCode==13){
var val=document.getElementById("search").value;
window.location="listPro.php?keywords="+val;
}
}
function change(val){
window.location="listPro.php?order="+val;
}
</script>
<body>
<div id="showDetail" style="display: none;"></div>
<div class="details">
<div class="details_operation clearfix">
<div class="bui_select">
<input type="button" value="添 加" class="add"
onclick="addPro()">
</div>
<div class="fr">
<div class="text">
<span>商品价格:</span>
<div class="bui_select">
<select id="" class="select" onchange="change(this.value)">
<option>-请选择-</option>
<option value="iPrice asc">由低到高</option>
<option value="iPrice desc">由高到底</option>
</select>
</div>
</div>
<div class="text">
<span>上架时间:</span>
<div class="bui_select">
<select id="" class="select" onchange="change(this.value)">
<option>-请选择-</option>
<option value="pubTime desc">最新发布</option>
<option value="pubTime asc">历史发布</option>
</select>
</div>
</div>
<div class="text">
<span>搜索</span> <input type="text" value="" class="search"
id="search" onkeypress="search()">
</div>
</div>
</div>
<!--表格-->
<table class="table" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th width="10%">编号</th>
<th width="20%">商品名称</th>
<th width="10%">商品分类</th>
<th width="10%">是否上架</th>
<th width="15%">上架时间</th>
<th width="10%">慕课价格</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php
foreach ( $rows as $row ) :
?>
<tr>
<!--这里的id和for里面的c1 需要循环出来-->
<td><input type="checkbox" id="c1" class="check"
value=<?php echo $row['id'];?>><label for="c1" class="label"><?php echo $row['pSn'];?></label></td>
<td><?php echo $row['pName'];?></td>
<td><?php echo $row['cName'];?></td>
<td>
<?php
$isshow = $row ['isShow'] == 1 ? "上架" : "下架";
echo $isshow;
?>
</td>
<td>
<?php
echo date ( 'Y-m-d H:i:s', $row ['pubTime'] );
?>
</td>
<td><?php echo $row['iPrice'];?>元</td>
<td align="center">
<input type="button" value="详情" class="btn" onclick="showDetail(<?php echo $row['id'];?>, <?php echo $row['pName'];?>)">
<input type="button" value="修改" class="btn" onclick="editPro()">
<input type="button" value="删除" class="btn" onclick="delPro()">
<div id="showDetail<?php echo $row['id'];?>"
style="display: none;">
<table class="table" cellspacing="0" cellpadding="0">
<tr>
<td width="20%" align="right">商品名称</td>
<td><?php echo $row['pName'];?></td>
</tr>
<tr>
<td width="20%" align="right">商品类别</td>
<td><?php echo $row['cName'];?></td>
</tr>
<tr>
<td width="20%" align="right">商品货号</td>
<td><?php echo $row['pSn'];?></td>
</tr>
<tr>
<td width="20%" align="right">商品数量</td>
<td><?php echo $row['pNum'];?></td>
</tr>
<tr>
<td width="20%" align="right">商品价格</td>
<td><?php echo $row['mPrice'];?></td>
</tr>
<tr>
<td width="20%" align="right">幕课网价格</td>
<td><?php echo $row['iPrice'];?></td>
</tr>
<tr>
<td width="20%" align="right">商品图片</td>
<td>xxx</td>
</tr>
<tr>
<td width="20%" align="right">是否上架</td>
<td>
<?php
echo $row ['isShow'] == 1 ? "上架" : "下架";
?>
</td>
</tr>
<tr>
<td width="20%" align="right">是否热卖</td>
<td><?php echo $row['isHot']==1?"热卖":"不热卖";?></td>
</tr>
</table>
<span style="display: block; width: 80%;"> 商品描述<br />
<?php echo $row['pDesc'];?>
</span>
</div></td>
</tr>
<tr>
<td colspan="7"></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
</body>
</html>