js弹出层评论前判断是否要登录

Systemnews1Action.class.php

public function news(){
			session_start();
			if (isset($_SESSION['user']) && !empty($_SESSION['user'])) {
				$user = $_SESSION['user'];
				$this->assign("user",$user);
			}
			$news = D('System_news1')->where(array('id'=>$_GET['id']))->find();
			$this->assign('news',$news);
			$comments = D('Comments')->join('pigcms_user on pigcms_comments.uid=pigcms_user.uid')->where(array('nid'=>$_GET['id']))->order("pigcms_comments.id desc")->limit(5)->select();
			$this->assign("comments",$comments);
			$this->display();
		}

news.php

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8"/>
		<title></title>
		<link rel="stylesheet" href="http://localhost/tpl/wap/static/css/jquery.dialogbox.css">
		<script type="text/javascript" src="http://localhost/tpl/wap/static/js/jquery.min.js"></script>
		<style>
    <script type="text/javascript">
		function pl(){
			var uid = $("#uid").val();
			if(uid == ''){
				$('#type-dialogBox2').dialogBox({
					title: "登录提示",  //标题内容,如果不设置,则连同关闭按钮(不论设置显示与否)都不显示标题
					width: 260,
					height: 150,
					hasMask: true,
					hasClose: true,
					confirmValue: "是",  //确定按钮文字内容
					confirm: function(){alert(1)}, //点击确定后回调函数
					cancelValue: "否",  //取消按钮文字内容
					hasBtn: true,
					content: '登录失败,重新登录!',
					function($btn){
						if($btn == "确定") {
							$('#type-dialogBox2').dialogbox({type:"normal",title:"Result",message:"You pressed: Ok"});
						}
					}
				});
				return false;
			}
		}
    </script>
	</head>
		<body>
		<div id="type-dialogBox2"></div>
		<div>
              
				<input type="hidden" id="uid" value="{pigcms{$user.uid}"/>
                <input type="button" id="retry_ignore_abort2" onClick="pl()" class="btn" value="评论"/>
                <br />
                </div>
		<script src="http://localhost/tpl/wap/static/js/jquery.dialogBox.js"></script>
	</body>
</html>
 

dialogBox插件下载地址:

http://download.csdn.net/download/ougexingfuba/9883153

效果如下:



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ougexingfuba

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值