当前位置:网站首页>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 .
边栏推荐
- Hutool dynamically adds scheduled tasks
- Dynamic programming: longest common substring and longest common subsequence
- Téléchargement et installation du client Filezilla
- Yolov5 project based on QT
- [leetcode question brushing day 34] 540 Unique element in array, 384 Disrupt array, 202 Happy number, 149 Maximum number of points on a line
- Ffmpeg recording screen and screenshot
- Advanced redis applications [password protection, data persistence, master-slave synchronization, sentinel mode, transactions] [not completed yet (semi-finished products)]
- Node start server
- Ffmpeg download and installation tutorial and introduction
- Don't use the new Dede collection without the updated Dede plug-in
猜你喜欢

Use three JS make a simple 3D scene

Limit of one question per day

简易版 微信小程序开发之页面跳转、数据绑定、获取用户信息、获取用户位置信息

Ffmpeg download and installation tutorial and introduction

Small guide for rapid formation of manipulator (VIII): kinematic modeling (standard DH method)

Section 26 detailed explanation and demonstration of IPSec virtual private network configuration experiment - simulation experiment based on packettracer8.0

ffmpeg录制屏幕和截屏

Tidal characteristics of the Bohai Sea and the Yellow Sea

Recursion: quick sort, merge sort and heap sort

900w+ data, from 17s to 300ms, how to operate
随机推荐
File rename
2020-01-01t00:00:00.000000z date format conversion
Hutool动态添加定时任务
Dynamic programming: longest common substring and longest common subsequence
QQ小程序开发之 一些前期准备:预约开发账号、下载安装开发者工具、创建qq小程序
sigaction的使用
Open Visual Studio 2010 hangs when opening a SQL file sql file
LVGL使用心得
监听对象中值变化及访问
Mysql Mac版下载安装教程
Lvgl usage experience
递归使用和多维数组对象变一维数组对象
简易版 微信小程序开发之for指令、上传图片及展示效果优化
没有sXid,suid&sgid将进入险境!-尚文网络xUP楠哥
Limit of one question per day
leetcode:动态规划模板
Unity3d RPG implementation (medium)
Ansible introduction [unfinished (semi-finished products)]
ffmpeg之 一张/多张图片合成视频
Change and access of median value of listening object