<style type="text/css"> 
#alert {z-index:1000;position:absolute;display:none; left:30%; left:auto\9;} 
#scan {z-index:1000;position:absolute;display:none; left:30%; left:auto\9;top:20%;} 
.tcdiv{ width:470px; border:1px solid #b0c5e9;  font-size:12px; background:#d1dce9;}
#nav2_content{margin:0px auto 10px auto; background:#f4f7fc;width:450px;border:1px solid #b0c5e9;}
.tableshuru{ width:90%; margin:5px auto; }
.tableshuru td{ padding:3px 2px; word-wrap:break-word; word-break:break-all;}
.tableshuru td a{ color:#0033CC; text-decoration:none;}
.tableshuru td a:hover{ color:red;}
.tdcenter{ text-align:center;}
.but02{ width:4em; height:1.8em; vertical-align:middle; cursor:pointer; margin:0 10px;}
.input01{ height:20px; border-top:1px solid #696969;border-left:1px solid #696969; border-bottom:1px solid #e4e4e4; border-right:1px solid #e4e4e4;}
.ckword {font-size: 16px;font-weight: bold;color: #0099FF;}
</style>
<script type="text/javascript"> 
var i = 0;
 //1代表IE 2代表火狐 3代表Opera 4代表其他 这里只分IE和火狐
if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0)) {
i = 1;
} else if (navigator.userAgent.indexOf('Firefox') >= 0) {
i = 2;
} else if (navigator.userAgent.indexOf('Opera') >= 0) {
i = 3;
} else {
i = 4;
};//弹出窗口
function tanchu(alertid,id,type){
if(id!=''){
if(type=='syc' || type=='xyc'){
//alert(111);
handledata('post',jsroot+"choicekeyword/scanchoicekeywordfc/id:"+id+"/type:"+type,'','json',scanchoicekeywordResponse);
}else{
//alert(222);
handledata('post',jsroot+"choicekeyword/scanchoicekeyword/id:"+id,'','json',scanchoicekeywordResponse);
}

}
$("#id").val(id);
var obj = document.getElementById(alertid); 
obj.style.display = "block"; 
var aaa = document.documentElement.clientHeight;
var bbb = document.body.clientHeight;
var top = document.documentElement.scrollTop + (document.documentElement.clientHeight -obj.offsetHeight) / 2;
var left = (document.documentElement.clientWidth - obj.offsetWidth) / 2;
obj.style.left = left+'px'; 
obj.style.top = top+'px';//修改里面的高度
  var s=document.getElementById('mybg');
 if(!s){
mybg = document.createElement("div"); 
mybg.setAttribute("id","mybg"); 
mybg.style.background = "#000"; 
mybg.style.width = "100%"; 
if(bbb>aaa){
mybg.style.height = document.body.clientHeight+'px'; 
}else{
mybg.style.height = document.documentElement.clientHeight+'px'; 
}
mybg.style.position = "absolute"; 
mybg.style.top = "0"; 
mybg.style.left = "0"; 
mybg.style.zIndex = "200"; 
mybg.style.opacity = "0.5"; 
mybg.style.filter = "Alpha(opacity=50)"; 
document.body.appendChild(mybg);
document.body.style.overflow = "hidden"; 
 }else{
  document.getElementById('mybg').style.display="block";
 }
}
//关闭窗口
function mclose(alertid){
var obj = document.getElementById(alertid); 
obj.style.display = "none"; 
mybg.style.display = "none"; 
document.body.style.overflow = ""; 
}
//查看用户
function scanchoicekeywordResponse(request){
$("#id").html(request.id);
$("#keywords").html(request.keyword);
$("#yessearch").html(request.yessearch);
$("#hot").html(request.hot);
$("#newscount").html(request.newscount);
$("#tzcount").html(request.tzcount);
}//搜索
function searchData(){
var keyword = $("#keyword").val();
keyword = keyword.replace(new RegExp("%","gm"),"");
keyword = keyword.replace(new RegExp("/","gm"),"");
var params = jsroot + "choicekeyword/choicelist/keyword:" + encodeURIComponent(keyword);
tz(params);
}
//提交
function operate(op,id){
if(op=='choicemore'){
var ids='';
var msg='';
var box = document.getElementsByTagName("input"); 
for (var i=0;i<box.length;i++ ){
if(box[i].type=="checkbox"){
if(box[i].checked==true){ 
ids += box[i].value+','; 
}
}
}
ids = ids.substr(0,ids.length-1); 
if(ids.length<1){
alert("您未选择任何信息,请选中要提交的信息!");
return false;
}else{
if(confirm("确认提交已选择的信息?")){
var params ="op="+ op + "&id="+ ids;
}else{
return false;
}
}
}
else
{
var params ="op="+ op + "&id="+ id;
}
handledata('post',jsroot+"choicekeyword/addchoice/",params,'json',addchoiceResponse);
}function addchoiceResponse(request){
 if(request.code==1){
  alert(request.msg);
  location.reload();
 }else{
  alert(request.msg);
  return false;
 }
}</script>
<div class="daohang">
     <div class="dhl">
    您的位置:<a href="<?php echo $rooturl.'welcome';?>" class="blue">首页</a> &gt;&gt; 选词中心 &gt;&gt;<?php echo $htmltitle;?>
 </div>
  </div>
  
  <div class="change">
  <form name="searchform" id="searchform" action="" method="GET">
    <div class="cfl">
   <ul>
       <?php echo $pagehtml;?>
  <li><div class="jgbg"></div></li>
  <li><input type="text" id="keyword" value="<?php echo $keyword;?>" class="textbox text85" /></li>
     <li><a href="#" class="ss" onclick="searchData();" >搜索已选择词</a></li>
   </ul>
</div>
</form>
<div class="cfr">
  已选择&nbsp;<span style="color:red"><b><?php echo $total;?></b></span>&nbsp;个词
</div>
<div class="cfr">
  <li><a href="<?php echo $rooturl.'choicekeyword/subchoicelist';?>" target="_blank">查看已提交词</a></li>
    </div> 
<div class="clear"></div>
  </div>
<div class="change">  
  <div class="cfr">
  <li><a href="#" class="tj" onclick="operate('choicemore');">提交选择的词</a></li>
  </div>
  <div class="cfr">
  <li><b>排序</b>:按收录时间:<a href="<?php echo $rooturl.'choicekeyword/choicelist?px=1';?>">↑</a>&nbsp;<a href="<?php echo $rooturl.'choicekeyword/choicelist?px=2';?>">↓</a>&nbsp;&nbsp;&nbsp;按搜索量:<a href="<?php echo $rooturl.'choicekeyword/choicelist?px=3';?>">↑</a>&nbsp;<a href="<?php echo $rooturl.'choicekeyword/choicelist?px=4';?>">↓</a>&nbsp;<a href="<?php echo $rooturl.'choicekeyword/choicelist';?>">初始</a>&nbsp;</li>
  </div>
</div>
   </div>
   


   <div class="main">
      <table cellpadding="0" cellspacing="0" class="tableliebiao">
    <thead>
     <tr>
    <th width="4%"><a href="javascript:;" onclick="SelectAll()">全选</a></th>
<th width="15%">关键词</th>
<th width="10%">昨日搜索量</th>
<th width="10%">资讯量</th>
<th width="10%">帖子量</th>
<th width="10%">热度排名</th>
<th width="15%">收录时间</th>
<th width="10%">操作</th>
 </tr>
</thead>
<tbody> 
<?php foreach ($res as $k=>$v){?>
 <tr>
   <td class="tdcenter"><input type="checkbox" name="checkboxid" value="<?php echo $v['id']?>"/></td>
   <td><a href="#" onclick="tanchu('scan','<?php echo $v['id'];?>');"><?php echo $v['keyword']?></a></td>
   <td><?php echo $v['yessearch']?></td>
   <td align="center"><?php echo $v['newscount']?></td>
   <td align="center"><?php echo $v['tzcount'];?></td>
   <td align="center"><?php echo $v['hot'];?></td>
   <td align="center"><?php echo date('Y/m/d H:i',$v['post_time']-9*60);?></td>
   <td class="tdcenter"><a href="#" onclick="if(confirm('确定要提交选择的条目吗?')){operate('choiceone','<?php echo $v['id'];?>');}">提交</a></td>
 </tr>
 <?php }?>
</tbody> 
  </table>
  
   </div>
  <div class="tcdiv" id="scan">
<div style="font-size:12px;height:20px;margin-left:10px;margin-top:4px;">查看关键词</div>
  <div id="nav2_content">
    <div>
      <table cellspacing="0" cellspacing="0" class="tableshuru">
    <tbody>
     <tr>
    <td colspan="2"><span class="ckword" id="keywords"></span></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><input type="checkbox" name="checkboxid" value="" id="id" />&nbsp;选择该词</td>
    <td>&nbsp;</td>
    <td><a href="#" onclick="tanchu('scan','','syc');">上一词</a></td>
    <td><a href="#" onclick="tanchu('scan','','xyc');">下一词</a></td>
  </tr>
  <tr>
    <td colspan="8">——————————————————————————————————</td>
  </tr>
  <tr>
    <td>昨日搜索量:</td>
    <td><span style="color:red" id="yessearch"></span></td>
    <td>热度排名:</td>
    <td><span style="color:red" id="hot"></span></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>昨日新闻量:</td>
    <td><span style="color:red" id="newscount"></span></td>
    <td>昨日帖子量:</td>
    <td><span style="color:red" id="tzcount"></span></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="8">——————————————————————————————————</td>
  </tr>  
  <tr>
      <td colspan="2" class="tdcenter"><a href="#" onclick="if(confirm('确定要提交选择的条目吗?')){operate('choiceone','');}">提交</a><input type="button" value="关闭" class="but02" onclick="mclose('scan')" /></td>
  </tr>
</tbody>
  </table>
</div>
  </div> 
</div>
</div>红色那里要得到弹出查看框的ID值,得怎么弄额?

解决方案 »

  1.   

    额  怎么没变红。。就是这里。tanchu('scan','这个ID值怎么获得额?','syc')<td><a href="#" onclick="tanchu('scan','','syc');">上一词</a></td>
    <td><a href="#" onclick="tanchu('scan','','xyc');">下一词</a></td>
      

  2.   

    什么id?
    jquery的
    $("#xxid").text()
      

  3.   

    没明白楼主的意思。没有id那你的onclick函数怎么运行的???
      

  4.   


    在上面定义了这样一个函数啊。tanchu('scan','','syc')
    第一项是弹出框div的id值,第2项是弹出框里得到数据库的id值。我现在弹出这个框以后。能得到数据。但要做一个上下词翻页的功能,所以还想用到
    tanchu这个函数。然后不知道该怎么把弹出框里得到的数据库返回来的id值放到这里了。
      

  5.   

    写错了 第2项是要进行传递的id值。我现在不知道怎么把弹出框里的id值再一次放入这个函数,然后再进行一次操作。
      

  6.   

    这是后台PHP或者数据库SQL的问题,和JS无关。大意应该是如何根据一个指定的ID,得到这个ID的上一条记录的ID和下一条记录的ID,是吧。解决思路:这种ID基本应该是单向增长的,但不一定连续(因为有删除)。所以用下面两条语句就可以分别得到:上一个记录的ID:
     SELECT MAX(ID) FROM 表 WHERE ID<本次关键词对应的ID下一个记录的ID:
     SELECT MIN(ID) FROM 表 WHERE ID>本次关键词对应的ID
      

  7.   

    后台得到上一条和下一条的ID之后,写在
    <td><a href="#" onclick="tanchu('scan','','syc');">上一词</a></td>
    <td><a href="#" onclick="tanchu('scan','','xyc');">下一词</a></td>
    里面就可以了。所以说和JS与JQ无关。当然,这只是粗看了一下得出的印象。