日期:2014-05-16  浏览次数:20348 次

急急急 很简单的函数调用问题 求大家来指导 JS新手
本帖最后由 u010354801 于 2013-06-28 09:55:49 编辑

jQuery(function(){
  $j(".toupiaobtn .btn1, .toupiaobtn.btn2").click(function(e){  
注意这里 两个按钮 第一个按钮 调用下面这个函数my_alert 第二个按钮
也是需要调用这个函数 但是出现的CSS界面是不一样的
 我已经写好了CSS 但是不知道两个按钮如何调用用一个函数 显示不同的弹出框
  求解 
    myvote();
  });
  $j('#yzm').click(function(e){this.src='includes/rand_func.php?rc='+Math.random();});
});


function my_alert(i,values){    //调用这里  下面这个函数有判断 求解
var x=$j(document).height();
var y=$j(window).width(); 
$j(".hide").show();
$j(".close").show();
$j(".haha").css({height:x+"px",display:"block",right:y+"px"}).animate({right:"0"},400);
$j(".hide").animate({top:"30%"},1000,function(){$j(this).animate({top:"20%"},500,function(){$j(this).animate({top:"25%"},1000)
})
});
    if(i==0){
  $j(".tishi").text(values);
   $j(".no,.sures,.xinxi").show();
}else{
     $j(".tishi").text(values);
   $j(".yes,.sure,.xinxis").show();
}
}


function myvote()
{    
<?php
$ip=getip();
$total_votes = '0';
$vtime = '0000000000';
//查询某IP当天投票总数
//查询24小时: WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(add_time)<=86400 
$sql="select sum(votes) as total_votes from ".$dbtablepre."voterec  where date(FROM_UNIXTIME(vtime))=CURDATE() and ip='$ip'";
$db->query($sql);
$tmp_rs=$db->fetchRow();
if( $tmp_rs && is_numeric($tmp_rs['total_votes']) && $tmp_rs['total_votes'] > 0)
{
$total_votes = $tmp_rs['total_votes'];
}
//var_dump($total_votes);
//查询某IP最后投票记录
//查询24小时: WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(add_time)<=86400 
$sql="select vtime from ".$dbtablepre."voterec  where ip='$ip'";
$db->query($sql);
$tmp_rs=$db->fetchRow();
if( $tmp_rs )
{
$vtime = $tmp_rs['vtime'];
}
?>

    var url = 'ajax.php';
    var user='<?php if(!empty($username)) echo $username;else echo '';?>';
    var nowtime= <?php echo $vtime . $total_votes;?>;
    <?php 
    if($config['isloginv']==0)