JS:实用功能
| ylbtech-jQuery:函数-导航 |
| jQuery:3.1,添加样式(addClass)、移除样式(removeClass) 返回顶部 |
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
.selected{ background-color:red}
</style>
<script type="text/javascript" src="jquery-1.4.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("p").toggle(function(){
$(this).addClass("selected");
},function(){
$(this).removeClass("selected");
});
});
</script>
</head> <body>
<p>ylbtech</p>
<p>ylbtech</p>
<p>ylbtech</p>
<p>ylbtech</p> </body>
</html>
| jQuery:3.2,轮替函数(toggle()) 返回顶部 |
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
.select{background-color:red;
}
</style>
<script type="text/javascript" src="jquery-1.4.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#btn1").click(function(){
$(this).addClass("select");
});
$("#btn2").click(function(){
$(this).removeClass("select");
});
$("#btn3").click(function(){
$(this).toggleClass("select");
});
});
</script>
</head> <body>
<input id="btn1" type="button" value="ajax1" />
<input id="btn2" type="button" value="ajax2" class="select" />
<input id="btn3" type="button" value="ajax1" />
</body>
</html>
| jQuery:3.3,选项拼加 返回顶部 |
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function list(check_b,txt)
{
var str_S=txt.value;
var str_C=check_b.value;
if(check_b.checked==true)
{
txt.value=str_S+str_C;
}
else
{
str_S=str_S.replace(str_C,"");
txt.value=str_S;
}
}
</script>
</head> <body>
我们选择了:<input type="text" name="t_1" value="" readonly="true" />
<br />
<input type="checkbox" value="苹果 " onclick="list(this,t_1)" >苹果</input>
<input type="checkbox" value="香蕉 " onclick="list(this,t_1)" >香蕉</input>
<input type="checkbox" value="芹菜 " onclick="list(this,t_1)" >芹菜</input>
</body>
</html>
| jQuery:3.4全选 返回顶部 |
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript">
function ca()
{
for(i=0;i<f.news.length;i++)
{
f.news[i].checked=f.all.checked;
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title>
</head> <body><br />
<form name="f" style="font-size:36px">
全选<input type="checkbox" name="all" onclick="ca()"/><br />
军事<input type="checkbox" name="news"/><br />
政治<input type="checkbox" name="news"/><br />
娱乐<input type="checkbox" name="news"/><br />
体育<input type="checkbox" name="news"/><br />
</form>
</body>
</html>
| jQuery:3.5网页刷点器 返回顶部 |
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>袁博刷点 高效一流</title>
<script language="javascript">
var count=3;
var sumcount=100;//默认100次
var intervalid;
var url;
function funfirst()
{
intervalid=setInterval("fun1()",1000)
var txtsum=document.getElementById("txtcount").value;
if(txtsum.length!=0)
{
sumcount=parseInt(txtsum);
}
}
function fun1()
{
sumcount--;
var onclickurl=document.getElementById("txturl").value;
url=window.open("http://"+onclickurl,"_blank","");
if(sumcount<=1)
{
fun3();
}
fun2();
}
function fun2()
{
count--;
if(count<0)
{
url.close();
}
}
function fun3()
{
clearInterval(intervalid);
}
</script> </head> <body> 请在下输入你想要刷的网址(注:本产品仅支持在IE浏览器使用)
<table width="326" border="1">
<tr>
<td width="168"><input type="text" id="txturl" /></td>
<td width="68"><input type="button" value="开始刷点" onclick="funfirst()"></td>
<td width="68"><input type="button" value="停止刷点" onclick="fun3()" /></td>
</tr>
<tr>
<td height="33">格式如:www.baidu.com</td>
<td>刷点次数</td>
<td><input type="text" id="txtcount" width="20px" />
默认为100次</td>
</tr>
</table> </body>
</html>
![]() |
作者:ylbtech 出处:http://ylbtech.cnblogs.com/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 |
JS:实用功能的更多相关文章
- js实用功能
//日期格式转换 Date.prototype.format = function (format) { /* * eg:format="yyyy-MM-dd hh:mm: ...
- 移动端报表JS开发示例
最近对移动端的报表开发颇有研究,细磨精算了好久,虽然到现在还是“囊中羞涩”,但决定还是先抛砖引玉,拿点小干货出来和大家分享. 研究的工具是比较有代表性的FineReport. 1. 移动端哪些地方支 ...
- Underscore.js使用
Underscore 是一个 JavaScript 工具库,它提供了一整套函数式编程的实用功能,但是没有扩展任何 JavaScript 内置对象. 他解决了这个问题:"如果我面对一个空白的 ...
- 钉钉js依赖库学习
看别人用的依赖库的好处在于,你知道有什么可以用,什么可以借鉴.(钉钉——协作桌面应用) PS:人最怕是不知道,而不是你不会. 1. jQuery 钉钉使用了1.9.1版本的jQuery,jQuery作 ...
- 百度地图 api 功能封装类 (ZMap.js) 本地搜索,范围查找实例 [源码下载]
相关说明 1. 界面查看: 吐槽贴:百度地图 api 封装 的实用功能 [源码下载] 2. 功能说明: 百度地图整合功能分享修正版[ZMap.js] 实例源码! ZMap.js 本类方法功能大多使用 ...
- sublime Text 3实用功能和常用快捷键收集
下面是我通过网上视频教程或文本资料学习sublime Text3时收集的一些实用功能和常用快捷键,现在分享出来,如果还有其它的好用的功能可以在下面留言,以便互相学习. PS:ST3在Mac OX与Wi ...
- template模版与Underscore.js
template模版与Underscore.js 在项目中经常使用的模版是Underscore这个js框架的实用功能. 在html里面设定模板,然后js绑定数据,这样能避免在js中出现非常多的html ...
- js 模板引擎 - 超级强大
本来没想写这篇文章,但是网上误导大众的文章太多了,所以今天就抽出半小时时间谈一下我对前端模板引擎的感受吧. 前端模板引擎相信大家都再熟悉不过了,市面上非常多的号称最好.最快.最牛逼的,随便就能找到一大 ...
- Node.js工具模块
在Node.js的模块库中提供实用的模块数量. 这些模块都是很常见的,并同时开发基于任何节点的应用程序频繁使用. S.N. 模块的名称和说明 1 OS Module提供基本的操作系统相关的实用功能 2 ...
随机推荐
- git init 与 git init --bare 的区别
git init 和 git init –bare 的区别 使用命令"git init --bare"(bare汉语意思是:裸,裸的)初始化的版本库(暂且称为bare repos ...
- H5 移动Web框架集合
http://frozenui.github.io/ 一个简洁的h5前端框架 http://weui.github.io/weui/ 腾讯出的WebUI 风格是基于微信
- form表单中的enctype属性什么意思?
enctype就是encodetype翻译成中文就是编码类型的意思!multipart/form-data是指表单数据有多部分构成:既有文本数据,又有文件等二进制数据的意思.另外需要注意的是:默认情况 ...
- 小米2S 连接Ubuntu Android Studio
1. 首先打开手机上的开发者选项,USB调试.拨号:*#*#717717#*#* ,手机会以Toast形式出现“……enable”字样.再次拨号可disable. 2. Ubuntu安装mtpfs: ...
- 套题T2
数学(math.cpp) DXY的数学很差... 对于所有1<=i<=N求(2^i – i^2)能被7整除的个数.(N<=1000000) 样例输入: 3 样例输出: 1 你在代码中 ...
- Mysql数据库int(1)和tinyint(1)的区别&&扩展阅读
转自:http://blog.csdn.net/phpwish/article/details/7845921 今天看项目的数据库结构设计,发现一个奇怪的地方. `xxx_detail` `del ...
- HTML5入门3---视频播放器
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta na ...
- 开源调度框架Quartz最佳实践
开源调度框架Quartz最佳实践 Quartz是一个Java调度框架,当前的最新版本为2.2.1. 以Quartz 2.2.1版为例,Quartz最佳实践(用于生产系统)总结如下: 1.跳过更新检查Q ...
- Android学习之-TextView的滑动效果
textView中如何设置滚动条 在xml中定义: <TextView android:layout_width="wrap_content" ...
- 【Android多屏适配】动态改变Listview item高度
在ListView的Adapter中去直接获取传入View的LayoutParams是会报空指针异常的,唯一的方法是在xml中嵌套布局一层LinearLayout <?xml version=& ...
