当前位置:网站首页>Role of JS No
Role of JS No
2022-07-03 03:38:00 【South wind ~ ancient grass】
1、# representative id Selectors
Such as $("#LUsername").val();( Get the corresponding id The value of the object )
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div>
<label>
<span> user name </span>
<input type="text" id="LUsername" />
</label>
<label>
<span> password </span>
<input type="password" id="LPassword"/>
</label>
<button type="button" class="submit" id="login" onclick="return check();"> deng record </button>
</div>
</body>
<script type="text/javascript" src="js/jquery-3.6.0.min.js"></script>
<script>
function check(){
var username = $("#LUsername").val();/* Get id by LUsername Of input The value corresponding to the input box */
var password= $("#LPassword").val();/* Get id by LPassword Of input The value corresponding to the input box */
console.log(" user name :"+username)
console.log(" password :"+password)
}
$(function () {
document.onkeydown=keyDownSearch;
function keyDownSearch(e) {
var theEvent = e || window.event;
var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
if(code==13){
$('#login').click();
return false;
}
return true;
}
})
</script>
</html>
In the above code , use js Completed the simple monitoring of the login button .
After clicking the login button , On the button onclick Going to call check() function , adopt id The selector takes the value of the object after it gets it .
Set the value in Console Console output .
边栏推荐
- C语言HashTable/HashSet库汇总
- Pat class B "1104 forever" DFS optimization idea
- 【AI实战】应用xgboost.XGBRegressor搭建空气质量预测模型(一)
- Positioning (relative positioning, absolute positioning, fixed positioning, Z-index) 2022-2-11
- Téléchargement et installation du client Filezilla
- The difference between static web pages and dynamic web pages & the difference between Web1.0 and Web2.0 & the difference between get and post
- 【DRM】DRM bridge驱动调用流程简单分析
- @Accessors annotation function specifies that the prefix follows the hump naming
- Latest version of NPM: the "NPM" item cannot be recognized as the name of a cmdlet, function, script file, or runnable program. Please check
- 程序员新人上午使用 isXxx 形式定义布尔类型,下午就被劝退?
猜你喜欢

别再用 System.currentTimeMillis() 统计耗时了,太 Low,StopWatch 好用到爆!

Download and install node, NPM and yarn

Positioning (relative positioning, absolute positioning, fixed positioning, Z-index) 2022-2-11

Use three JS make a simple 3D scene

为什么线程崩溃不会导致 JVM 崩溃

900W+ 数据,从 17s 到 300ms,如何操作

用Three.js做一個簡單的3D場景

简易版 微信小程序开发之for指令、上传图片及展示效果优化

递归:深度优先搜索

Pytorch轻量级可视化工具wandb(local)
随机推荐
Captura下载安装及在Captura配置FFmpeg
[leetcode question brushing day 34] 540 Unique element in array, 384 Disrupt array, 202 Happy number, 149 Maximum number of points on a line
程序员新人上午使用 isXxx 形式定义布尔类型,下午就被劝退?
Ansible简介【暂未完成(半成品)】
node,npm以及yarn下载安装
Mysql Mac版下载安装教程
Nanning water leakage detection: warmly congratulate Guangxi Zhongshui on winning the first famous brand in Guangxi
[mathematical logic] normal form (conjunctive normal form | disjunctive normal form | major item | minor item | maximal item | minor item | principal conjunctive normal form | principal disjunctive no
Why does thread crash not cause JVM crash
Node start server
Applet get user avatar and nickname
Hutool动态添加定时任务
Stop using system Currenttimemillis() takes too long to count. It's too low. Stopwatch is easy to use!
小程序获取用户头像和昵称
Download and install node, NPM and yarn
[set theory] partial order relation (partial order relation definition | partial order set definition | greater than or equal to relation | less than or equal to relation | integer division relation |
The difference between static web pages and dynamic web pages & the difference between Web1.0 and Web2.0 & the difference between get and post
MySQL MAC download and installation tutorial
Latest version of NPM: the "NPM" item cannot be recognized as the name of a cmdlet, function, script file, or runnable program. Please check
FileZilla Client下載安裝