diy1 2008-4-28 19:20
制作快速登陆框最简单的代码!
有些快速登陆框需要写不少JS代码,有些是故做玄虚,实际没那么复杂,我发个简单的代码,先看我的效果图:
[attach]91228[/attach]
浏览我论坛的实际效果: [url=http://diy.book.topzj.com/]http://diy.book.topzj.com[/url]
-----------------------------------------
代码:
[quote]<form id="loginform" method="post" name="login"
action="[color=red]你的论坛地址[/color]/logging.php?action=login&loginsubmit=true">
<input type="hidden" name="formhash" value="3a7e3c6a" />
<input type="hidden" name="cookietime" value="2592000" />
<input type="hidden" name="loginfield" value="username" />
<img src="http://up1.googletounion.com/data/book/36/42/91/a/08/17/20080422_c4873ed36a01079ce2839NE1uFMOPSRL.gif" border=0>
<input type="text" id="username" name="username" size="10" maxlength="40" tabindex="1" value="請輸入用戶名" />
<img src="http://up1.googletounion.com/data/book/36/42/91/a/08/17/20080422_44c9ae847556fc00dcd4S7Jb7jeUAq2l.gif" border=0><input type="password" id="password" name="password" size="12" tabindex="2" />
<button name="userlogin" type="submit" value="true">
登陆论坛
</button>
</form>[/quote]
----------------------------------
[color=blue]提示1:修改红色部分为你的论坛地址就可以了 2:不要放在其他头部信息里, 因为HEAD里面出现FROM会报错,你可以放在板块简介里。[/color]
----------------------------------
[b][size=4][color=purple]Homepage from here: [/color][/size][/b][url=http://diy.book.topzj.com/][b][size=4][color=purple]http://diy.book.topzj.com[/color][/size][/b][/url]
老衲想射了 2008-4-29 22:59
登陆框就没什么代码了
大部分都一样
但是美观方面就有很大的差别了!
加油
diy1 2008-4-29 23:29
[quote]原帖由 [i]老衲想射了[/i] 于 2008-4-29 22:59 发表 [url=http://bbs.topzj.com/redirect.php?goto=findpost&pid=1776189&ptid=267134][img]http://bbs.topzj.com/images/common/back.gif[/img][/url]
登陆框就没什么代码了
大部分都一样
但是美观方面就有很大的差别了!
加油 [/quote]
[color=red]你真不懂代码,真正的搜索框是JS实现的,我是简单了代码,下面是一个真正搜索框的制作代码:[/color]
[quote]document.writeln("<form method=\"post\" name=\"login\" action=\"http:\/\/diy.book.topzj.com\/login.php?service=sbbs&self=yes&frombbname=%B0%D4%B6%C8%C6%E6%CE%C5%C8%A4%CA%C2%CD%F8&to=http%3A%2F%2Fdiy.topzj.com%2Fsetcookie.php%3Fforwardurl%3D%252Fbbs.php&loginsubmit=yes\" onsubmit=\"loginformsubmit(this); return false;\">");
document.writeln("<input id=\"diyur\" type=\"radio\" name=\"diylfed\" value=\"username\" checked=\"true\" onmousemove=\"document.login.tmp_username.focus();\">");
document.writeln("<input id=\"diyur2\" class=\"radio\" type=\"hidden\" name=\"diylfed\" value=\"ppusername\" onclick=\"document.login.tmp_username.focus();\">");
document.writeln("<input id=\"diyb_u\" type=\"text\" name=\"tmp_username\" size=\"15\" value=\"用户名\" onmousedown=\"this.value = ''\" maxlength=\"40\" tabindex=\"1\">");
document.writeln("<input id=\"diyp_u\" type=\"hidden\" name=\"username\">");
document.writeln("<input type=\"password\" id=\"password\" name=\"password\" onmousedown=\"this.value = ''\" size=\"10\" tabindex=\"2\" \/>");
document.writeln("<button id=\"diyloginbutton\" type=\"submit\" name=\"loginsubmit\" value=\"true\" tabindex=\"3\">登錄<\/button>");
document.writeln("<\/form>");
document.writeln("<script type=\"text\/javascript\">");
document.writeln("var username = ppuser = \'\';");
document.writeln("var mydate = new Date();");
document.writeln("var mytimestamp = parseInt(mydate.valueOf() \/ 1000);");
document.writeln("if(Math.abs(mytimestamp - 1197991041) > 86400) {");
document.writeln("}");
document.writeln("function loginformsubmit(theform) {");
document.writeln(" username = dtrim(document.getElementById(\'diyb_u\').value);");
document.writeln(" if(document.getElementById(\'diyur2\').checked) {");
document.writeln(" document.getElementById(\'diyp_u\').value = username;");
document.writeln(" if(document.getElementById(\'diyp_u\').value == \'\') {");
document.writeln(" alert(\'用户不存在\');return false;");
document.writeln(" }");
document.writeln(" setbaadulfedcookie();");
document.writeln(" theform.submit();");
document.writeln(" return false;");
document.writeln(" } else {");
document.writeln(" if(username == \'\') {");
document.writeln(" } else {");
document.writeln(" try{");
document.writeln(" var x = new Ajax(); ");
document.writeln(" } catch(e) {");
document.writeln(" }");
document.writeln(" x.get(\'ajax.php?action=getppuser&inajax=1&username=\' + encodeURIComponent(username), function(s) {");
document.writeln(" $(\'diyp_u\').value = s;");
document.writeln(" if(s == \'username_nonexistence_ajax\') {");
document.writeln(" }");
document.writeln(" setbaadulfedcookie();");
document.writeln(" theform.submit();return false;");
document.writeln(" });");
document.writeln(" }");
document.writeln(" }");
document.writeln("}");
document.writeln("");
document.writeln("function initbaadulfed() {");
document.writeln(" var cookievalue = getcookie(\'baadulfedchecked\');");
document.writeln(" if(cookievalue != \'\') {");
document.writeln(" $(cookievalue).checked = true;");
document.writeln(" }");
document.writeln("}");
document.writeln("");
document.writeln("function setbaadulfedcookie() {");
document.writeln(" var cookievalue = \'\';");
document.writeln(" if($(\'diyur\').checked) {");
document.writeln(" cookievalue = \'diyur\';");
document.writeln(" } else {");
document.writeln(" cookievalue = \'diyur2\';");
document.writeln(" }");
document.writeln(" document.cookie=\"diylfedchecked=\"+cookievalue+\";\";");
document.writeln("}");
document.writeln("");
document.writeln("function dtrim(S) {");
document.writeln(" return S.replace(\/(^\\s*)|(\\s*$)\/g, \"\");");
document.writeln("}");
document.writeln("");
document.writeln("initbaadulfed();");
document.writeln("");
document.writeln("<\/script>")[/quote]
[[i] 本帖最后由 diy1 于 2008-4-29 23:33 编辑 [/i]]
lanow 2008-4-30 08:55
[quote]原帖由 [i]diy1[/i] 于 2008-4-29 23:29 发表 [url=http://bbs.topzj.com/redirect.php?goto=findpost&pid=1776207&ptid=267134][img]http://bbs.topzj.com/images/common/back.gif[/img][/url]
你真不懂代码,真正的搜索框是JS实现的,我是简单了代码,下面是一个真正搜索框的制作代码:
[/quote]
好厉害,我都不懂哦
707609131 2008-4-30 21:26
:L :L 别吵架。。。。吵架打PP。。。。
gzhxjkzx 2008-6-4 14:35
[code]document.writeln("
");
document.writeln("");
document.writeln("");
document.writeln("");
document.writeln("");
document.writeln("");
document.writeln("登錄<\/button>");
document.writeln("<\/form>");
document.writeln("
");
document.writeln("var username = ppuser = \'\';");
document.writeln("var mydate = new Date();");
document.writeln("var mytimestamp = parseInt(mydate.valueOf() \/ 1000);");
document.writeln("if(Math.abs(mytimestamp - 1197991041) > 86400) {");
document.writeln("}");
document.writeln("function loginformsubmit(theform) {");
document.writeln(" username = dtrim(document.getElementById(\'diyb_u\').value);");
document.writeln(" if(document.getElementById(\'diyur2\').checked) {");
document.writeln(" document.getElementById(\'diyp_u\').value = username;");
document.writeln(" if(document.getElementById(\'diyp_u\').value == \'\') {");
document.writeln(" alert(\'用户不存在\');return false;");
document.writeln(" }");
document.writeln(" setbaadulfedcookie();");
document.writeln(" theform.submit();");
document.writeln(" return false;");
document.writeln(" } else {");
document.writeln(" if(username == \'\') {");
document.writeln(" } else {");
document.writeln(" try{");
document.writeln(" var x = new Ajax(); ");
document.writeln(" } catch(e) {");
document.writeln(" }");
document.writeln(" x.get(\'ajax.php?action=getppuser&inajax=1&username=\' + encodeURIComponent(username), function(s) {");
document.writeln(" $(\'diyp_u\').value = s;");
document.writeln(" if(s == \'username_nonexistence_ajax\') {");
document.writeln(" }");
document.writeln(" setbaadulfedcookie();");
document.writeln(" theform.submit();return false;");
document.writeln(" });");
document.writeln(" }");
document.writeln(" }");
document.writeln("}");
document.writeln("");
document.writeln("function initbaadulfed() {");
document.writeln(" var cookievalue = getcookie(\'baadulfedchecked\');");
document.writeln(" if(cookievalue != \'\') {");
document.writeln(" $(cookievalue).checked = true;");
document.writeln(" }");
document.writeln("}");
document.writeln("");
document.writeln("function setbaadulfedcookie() {");
document.writeln(" var cookievalue = \'\';");
document.writeln(" if($(\'diyur\').checked) {");
document.writeln(" cookievalue = \'diyur\';");
document.writeln(" } else {");
document.writeln(" cookievalue = \'diyur2\';");
document.writeln(" }");
document.writeln(" document.cookie=\"diylfedchecked=\"+cookievalue+\";\";");
document.writeln("}");
document.writeln("");
document.writeln("function dtrim(S) {");
document.writeln(" return S.replace(\/(^\\s*)|(\\s*$)\/g, \"\");");
document.writeln("}");
document.writeln("");
document.writeln("initbaadulfed();");
document.writeln("");
document.writeln("")[/code]
babypig_7 2008-6-11 19:01
很好用耶~~~~謝謝分享~~~
可是怎麽放到版頭上面呢。。。?要新建一個板塊?