首页 > 编程语言 >Python3项目初始化10-->JS基础、dom、jquery、database

Python3项目初始化10-->JS基础、dom、jquery、database

时间:2022-08-28 22:56:48浏览次数:60  
标签:jquery 10 console log -- https jQuery com

29、JS基础
var定义变量
数字字符串和Python一样
布尔值true和false首字母不大写
逻辑判断if () {} else if() {} else{}

借助浏览器console执行操作,见截图。

 

 

 

 Console使用操作入门

var age = 30
age
var name='kk'
name
var sex = 1
[1,2,3,4,5]
console.log(1)
if(sex) {console.log('男')}
if(!sex) {console.log('男')} else {console.log('女')}
var score = 60
if (score>=80) {console.log('优秀');} else if(score>=60) {console.log('及格')} else {console.log('加油')}
sum = 0
for(var i=0;i<=100;i+=1) {sum +=i}
sum
names = ['kk', 'woshishui']
names[1]
names[0] = 'test'

alert('删除成功')
prompt('请输入您的年龄: ')
confirm('确认删除吗? ')

function say_hello() {alert('hello...')};
say_hello()
function say_hello(name) {alert('hello...' + name)};
say_hello('test')
say_hello()

30、JS基础-dom jquery bom
DOM操作:具体指标跟网页源代码对应起来。
获取元素
document.getElementById
document.getElementByTagName
document.getElementByClassName
document.getElementByName
获取/修改标签
attr input->value
content div->content
onclick

 

 

修改样式:click,点击的时候做一个事情,用一个函数表示。
document.getElementsByTagName("button")[0].addEventListener('click', function() {alert(5)})

jQuery js库
选择器
id jQuery('#id')
tag jQuery('tag')
class jQuery('.class')
attr jQuery('[attr=value]')

属性 attr val addClass/removeClass

内容

jQuery是一个库,需要导入。
Bootstrap对jQuery版本有要求,需要匹配下。
导入jQuery库:https://v3.bootcss.com/getting-started/
在login.html页面演示:
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery,所以必须放在前边) -->
<script type="text/javascript"src="http://code.jquery.com/jquery-1.4.1.min.js"></script>
</body>
</html>

 

 

 

 

 

 

 

 

 

 

刷新页面:window.location.reload()

跳转页面:window.location.replace('/user/login')

31、JS基础-databases
组件标签:https://v3.bootcss.com/components/
组件引入
JavaScript 插件:https://v3.bootcss.com/javascript/
databases分页组件。
下载插件:https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js
下载datatable:http://datatables.net/releases/DataTables-1.10.21.zip
下载sweettalert:https://github.com/t4t5/sweetalert/archive/refs/tags/v1.1.0.zip
下载jQuery:https://code.jquery.com/jquery-1.12.4.js //https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js
开始创作。
改造index.html配置,静态文件自行准备。
<title>用户管理</title>
<link rel="stylesheet" type="text/css" href="{% static 'bootstrap-3.4.1-dist/css/bootstrap.min.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'sweetalert-1.1.0/dist/sweetalert.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'DataTables-1.10.21/media/css/jquery.dataTables.min.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'DataTables-1.10.21/media/css/dataTables.bootstrap.min.css' %}" />
<link href="../../static/navbar-fixed-top.css" rel="stylesheet">
</head>
...
<table id="table_user" class="table table-stripe table-bordered table-hover table-condensed">
...
</div> <!-- /container -->
<script type="text/javascript"src="{% static 'jquery/jquery-1.12.4.js' %}"></script>
<script type="text/javascript"src="{% static 'bootstrap-3.4.1-dist/js/bootstrap.min.js' %}"></script>
<script type="text/javascript"src="{% static 'sweetalert-1.1.0/dist/sweetalert.min.js' %}"></script>
<script type="text/javascript"src="{% static 'DataTables-1.10.21/media/js/jquery.dataTables.js' %}"></script>
<script type="text/javascript"src="{% static 'DataTables-1.10.21/media/js/dataTables.bootstrap.min.js' %}"></script>
<script>
jQuery(document).ready(function () {
jQuery('#table_user').DataTable();
})
</script>
</body>
访问效果:可以在前端操作,查询搜索,分页,显示分页数量。如下截图。备份“cmdb-8-28.rar”。

 

 验证ok。

标签:jquery,10,console,log,--,https,jQuery,com
From: https://www.cnblogs.com/sunnyyangwang/p/16634348.html

相关文章

  • 20220815今天学了干了什么?努力过好今天
    看课给了两个bug   js的课,那今天开这个课,就把它学明白。 这个知识点是什么呢?把它弄明白。 今天我能学什么知识?好好努力,顺其自然,自然社交,尊重别人,话说三分,得......
  • CSS三中样式(简单的代码)
    三中的使用方法的简单实例如下:行内样式:<!doctypehtml><html><head><metacharset="UTF-8"><title>css行内样式</title></head><body><divstyle="width:100px;h......
  • Flyway管理数据库MySQL5.7入坑记录(二)
    在成功加入Flyway的Gradle的插件后,在Gradle的任务中选择flyway->flywayMigrate,进行数据库迁移操作,于是出现下面的问题。第二坑:执行flyMigrate出现错误信息:flywayNodatab......
  • camera.c
     ......
  • leetcode刷题记录之25(集合实现)
    题目描述:给你链表的头节点head,每 k 个节点一组进行翻转,请你返回修改后的链表。k是一个正整数,它的值小于或等于链表的长度。如果节点总数不是 k 的整数倍,那么请将......
  • JS逆向实战1——某省阳光采购服务平台
    分析其实这个网站基本没有用到过什么逆向,就是简单的图片base64加密然后把连接变成2进制存成文件然后用ocr去识别即可!!注意在获取图片连接和对列表页发起请求时一定要......
  • Linux Kernel in a Nutshell - 7
    CustomizingaKernel原文链接我的博客以·问题·做关键字搜索,还有问题构建你自己的Linux内核版本最困难的部分,应该就是确定哪一个驱动以及配置选项是你的设备需要的......
  • Linux Kernel in a Nutshell - 8
    KernelConfigurationRecipes原文链接我的博客前面介绍了重新配置内核的机制,本章介绍制作自己的内核通常会遇到的那些问题,并给出对应指令来处理它。DisksLinux内核......
  • randomize( ) with Arguments
    当调用不带参数的randomize()方法时,它会为对象中的所有随机变量(声明为rand或randc)分配新值,满足所有约束。当使用参数调用randomize()时,这些参数指定该对象内的随机......
  • 硬盘的总类于接口划分
    1.     硬盘的种类与接口划分前言:作为存储研发人员,少不了数据的处理,硬盘作为存储数据的主要介质,是我们必须要深入了解的。下面介绍几个硬盘的基础概念。1.1. ......