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 ...
随机推荐
- 【leetcode】Majority Element (easy)(*^__^*)
Given an array of size n, find the majority element. The majority element is the element that appear ...
- 深入浅出Java并发包—原子类操作
我们知道,JDK1.5以后引入了并发包(java.util.concurrent)用于解决多CPU时代的并发问题,而并发包中的类大部分是基于Queue的并发类,Queue在大多数情况下使用了原子类(A ...
- zend studio 10破解/汉化(转发)
转发:http://blog.csdn.net/qq1355541448/article/details/16807429 Zend Studio 10正式版破解及汉化 2013年03月12日 ⁄ P ...
- 套题T6
过节(festival.cpp/c/pas) Dxy帮老师们过教师节的时候需要购买礼物.货架上有n 种礼物,每种礼物有不同的个数.每种礼物有价值和花费两种属性,帮他算出最大可以得到的价值.M是带的钱数 ...
- net中使用母版页
.net中使用母版页的优点 母版页提供了开发人员已通过传统方式创建的功能,这些传统方式包括重复复制现有代码.文本和控件元素:使用框架集:对通用元素使用包含文件:使用 ASP.NET 用户控件等.母版页 ...
- 两个List合并,过滤重复记录
import java.util.ArrayList; import java.util.HashSet; import java.util.Hashtable; import java.util.I ...
- 移植 FFMPEG-2.2.4 -(编译)
源码下载:http://www.ffmpeg.org/download.html编译安装: http://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu su ...
- C++:this指针
this指针 this关键字:表示本类中的对象成员,可以通过this指针访问当前类的成员//举例 //例 3.18 隐藏this指针的引例 #include<iostream> using ...
- ubuntu服务器/home/分区替换3T硬盘
一,关机,将硬盘连接到主机. 二,开机 1,查看/dev/ 是否有多余的sdb 注,sda,sdb可以直接看做一整块硬盘. 而sda1,sda2即sda硬盘上的分区. 2,执行fdisk –l,确保添 ...
- Maven远程仓库
根据Apache Maven声明:"只有当在本地和中心仓库找不到所需的依赖文件,才会到远程仓库去下载". 当在Maven里声明了一个本地和中心仓库都没有的库文件时,Maven会停止 ...