论坛留言板是如何实现非登录用户点击留言框弹出用户没有登录提示框的 论坛留言板是如何实现非登录用户点击留言框弹出用户没有登录提示框的,请问是不是session配合Java实现的,具体是一个什么样的实现过程。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以在浏览器中用 js 实现,也可以在服务器端语言中(比如 php)实现不知道你需要的是什么 要效果好点就是ajax,可以不跳转的提示。实现方法都是session记录用户登录状态。 ajax来实现。onfocus触发ajax求请求php检查是否登录。 Demo:<?php/* Created on [2012-5-21] Author[Newton] */?> <textarea name="message" rows="10" cols="50" onclick="checkUser()" wrap="off"> Give message please. </textarea> <script language="JavaScript" type="text/javascript">//Ajaxvar xmlHttp; function createXMLHttpRequest() { if(window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } else if (window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } } function checkUser(){ createXMLHttpRequest(); url = "action.php?check=ok&ran="+Math.random(); method = "GET"; xmlHttp.open(method,url,true); xmlHttp.onreadystatechange = show; xmlHttp.send(null); } function show(){ if (xmlHttp.readyState == 4){ if (xmlHttp.status == 200){ var text = xmlHttp.responseText; alert(text);exit; //document.getElementById("s2").innerHTML = text; //可将返回信息放入id为s2的div中 }else { alert("response error code:"+xmlHttp.status); } } } </script>#action.phpif(isset($_GET['check'])){ #mysql执行语句,检测用户是否存在 echo "检验中……";} 怎么既允许搜索引擎收录,又禁止其收录个别数据 关于php压缩解压缩文件的问题 如何在PHP网站放入视频? 求教:函数名前加$是什么意思啊? 用单选提交后返回页面,页面的单选选项就没了,点一下就刷新怎么解决呢? 新手求救!! 请教关于MySQL4的搜索问题 ob函数怪现象,怎样使用回掉函数而使implicit_flush功能不致失效? php中如何用程序实现:1\得到一个目录中的所有文件名?2\在session中,内容.3\内容. zend studio10提示系统函数不存在,自定义类警告不存在,请教应该怎样设置? PHP页面调用PHP页面怎么写? 瀑布流求指点。
不知道你需要的是什么
/* Created on [2012-5-21] Author[Newton] */
?> <textarea name="message" rows="10" cols="50" onclick="checkUser()" wrap="off">
Give message please.
</textarea> <script language="JavaScript" type="text/javascript">
//Ajax
var xmlHttp; function createXMLHttpRequest() {
if(window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
} function checkUser(){
createXMLHttpRequest();
url = "action.php?check=ok&ran="+Math.random();
method = "GET";
xmlHttp.open(method,url,true);
xmlHttp.onreadystatechange = show;
xmlHttp.send(null);
} function show(){
if (xmlHttp.readyState == 4){
if (xmlHttp.status == 200){
var text = xmlHttp.responseText;
alert(text);exit;
//document.getElementById("s2").innerHTML = text; //可将返回信息放入id为s2的div中
}else {
alert("response error code:"+xmlHttp.status);
}
}
}
</script>#action.php
if(isset($_GET['check'])){
#mysql执行语句,检测用户是否存在
echo "检验中……";
}