首页 > 编程知识 正文

js编写登录代码,html编写登录页面代码

时间:2023-12-27 22:26:38 阅读:324635 作者:UNGX

本文目录一览:

用javascript编写一段用户名和密码登录代码。点击登录按钮后,页面跳转到另一个页面,显示此用户名和密码的

function login()

{

var username=document.getElementById("userName");

var password=document.getElementById("password");

if(username.value=="admin"password.value="123456")

{

window.location.href="success.html";

}

}

为登录按钮注册onclick=“login()”

JS登录语法怎么写?

type="submit"这样的按钮本身就有提交功能。

a连接要提交。加上onclick事件,就是点击连接的事件。

a href="javascript:void(0)" class="login_btn" onclick="sub();"登录/a

给form id="su_form"加上id。

在js中写:

function sub(){

document.getElementById("su_form").submit;

}

用javascript脚本语言编写的html登陆界面代码

直接给你脚本哈

function check()

{

if(document.form1.username.value=="")

{

alert("请填写登录名称!");

return false;

}

if(document.form1.password.value=="")

{

alert("请填写登录密码!");

return false;

}

if(document.form1.username.value!="admin"document.form1.password.value!="123456")

{

alert("请认真填写用户名、密码!");

}

else

{

/*跳转代码*/

}

如何编写一个自动登录的js脚本

$(function(){

var name1=getCookie('name1');

var name2=getCookie('name2');

var name5=getCookie('name5');

dataForm="name1="+name1+"name2="+name2+"name5="+name5;

$.ajax({

type:"POST",

url:"login.php",

data:dataForm,

success:function(msg){

var str = eval('('+msg+')');

// 判断

}

});

});

function getCookie(c_name){

if(document.cookie.length0){

c_start=document.cookie.indexOf(c_name + "=")

if(c_start!=-1){

c_start=c_start + c_name.length+1

c_end=document.cookie.indexOf(";",c_start)

if(c_end==-1) c_end=document.cookie.length

return unescape(document.cookie.substring(c_start,c_end))

}

}

return "";

}

/script

JavaScript一种直译式脚本语言,是一种动态类型、弱类型、基于原型的语言,内置支持类型。它的解释器被称为JavaScript引擎,为浏览器的一部分,广泛用于客户端的脚本语言。

Html中js编写登录验证,求代码,谢谢!

function login(){

    if (document.login.usename.value== "logon"  document.login.password.value =="logon") {

        location.href="main.html";

}else{

   return false;

}

}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。