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:实用功能的更多相关文章

  1. js实用功能

    //日期格式转换 Date.prototype.format = function (format) {     /*      * eg:format="yyyy-MM-dd hh:mm: ...

  2. 移动端报表JS开发示例

    最近对移动端的报表开发颇有研究,细磨精算了好久,虽然到现在还是“囊中羞涩”,但决定还是先抛砖引玉,拿点小干货出来和大家分享. 研究的工具是比较有代表性的FineReport. 1.  移动端哪些地方支 ...

  3. Underscore.js使用

    Underscore 是一个 JavaScript 工具库,它提供了一整套函数式编程的实用功能,但是没有扩展任何 JavaScript 内置对象. 他解决了这个问题:"如果我面对一个空白的 ...

  4. 钉钉js依赖库学习

    看别人用的依赖库的好处在于,你知道有什么可以用,什么可以借鉴.(钉钉——协作桌面应用) PS:人最怕是不知道,而不是你不会. 1. jQuery 钉钉使用了1.9.1版本的jQuery,jQuery作 ...

  5. 百度地图 api 功能封装类 (ZMap.js) 本地搜索,范围查找实例 [源码下载]

    相关说明 1. 界面查看: 吐槽贴:百度地图 api 封装 的实用功能 [源码下载] 2. 功能说明: 百度地图整合功能分享修正版[ZMap.js] 实例源码! ZMap.js 本类方法功能大多使用 ...

  6. sublime Text 3实用功能和常用快捷键收集

    下面是我通过网上视频教程或文本资料学习sublime Text3时收集的一些实用功能和常用快捷键,现在分享出来,如果还有其它的好用的功能可以在下面留言,以便互相学习. PS:ST3在Mac OX与Wi ...

  7. template模版与Underscore.js

    template模版与Underscore.js 在项目中经常使用的模版是Underscore这个js框架的实用功能. 在html里面设定模板,然后js绑定数据,这样能避免在js中出现非常多的html ...

  8. js 模板引擎 - 超级强大

    本来没想写这篇文章,但是网上误导大众的文章太多了,所以今天就抽出半小时时间谈一下我对前端模板引擎的感受吧. 前端模板引擎相信大家都再熟悉不过了,市面上非常多的号称最好.最快.最牛逼的,随便就能找到一大 ...

  9. Node.js工具模块

    在Node.js的模块库中提供实用的模块数量. 这些模块都是很常见的,并同时开发基于任何节点的应用程序频繁使用. S.N. 模块的名称和说明 1 OS Module提供基本的操作系统相关的实用功能 2 ...

随机推荐

  1. HDU 1829 A Bug's Life(种类并查集)

    思路:见代码吧. #include <stdio.h> #include <string.h> #include <set> #include <vector ...

  2. POJ 1125 Stockbroker Grapevine(floyd)

    http://poj.org/problem?id=1125 题意 : 就是说想要在股票经纪人中传播谣言,先告诉一个人,然后让他传播给其他所有的经纪人,需要输出的是从谁开始传播需要的时间最短,输出这个 ...

  3. Ubuntu环境下利用ant编译nutch2.2.1 & 配置nutch2.2.1

    /×××××××××××××××××××××××××××××××××××××××××/ Author:xxx0624 HomePage:http://www.cnblogs.com/xxx0624/ ...

  4. 典型重构3 (Try/Catch)

    Try/Catch 块过多 public Customer GetCustomer(string customerId) { try { var command = new SqlCommand(); ...

  5. 【Linux高频命令专题(23)】tar

    概述 通过SSH访问服务器,难免会要用到压缩,解压缩,打包,解包等,这时候tar命令就是是必不可少的一个功能强大的工具.linux中最流行的tar是麻雀虽小,五脏俱全,功能强大. tar命令可以为li ...

  6. 腾讯QQ的开发分客户端软件和服务器端软件

    Windows客户端主要是C++ COM/ATL Q+Web 后端C++ CGI ,前端javascript和flash 望采纳 腾讯QQ使用何种开发平台? 腾讯QQ的开发分客户端软件和服务器端软件两 ...

  7. Restful api测试插件Swagger-UI

    现在多数的项目开发中,网站和移动端都需要进行数据交互和对接,这少不了使用REST编写API接口这种场景.例如我目前的工作,移动端交由了另一团队开发,不同开发小组之间就需要以规范和文档作为标准和协作基础 ...

  8. android.content.Context 含义及使用

    Context字面意思上下文,位于framework package的android.content.Context中,其实该类为LONG型,类似Win32中的Handle句柄,很多方法需要通过Con ...

  9. Android log日志

    LOG是用来记录程序执行过程的机制,它既可以用于程序调试,也可以用于产品运营中的事件记录.在Android系统中,提供了简单.便利的LOG机制,开发人员可以方便地使用. androidsdk中提供了l ...

  10. Codeforces Round #239 (Div. 2)

    做了三个题,先贴一下代码...终于涨分了 A. Line to Cashier 水题 #include <iostream> #include <cstdio> #includ ...