each

JQ——遍历(each遍历、数组遍历)、添加(append、appendTo)

 ̄綄美尐妖づ 提交于 2020-01-26 20:56:53
1、each实现遍历操作: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>each实现的遍历</title> <script type="text/javascript" src="../js/jquery-1.8.3.js" ></script> <script> $(function(){ $("button").click(function(){ $("li").each(function(){ alert($(this).text()) }); }); }); </script> </head> <body> <button>点击按键,each实现遍历操作</button> <ul> <li>2020</li> <li>新年好!</li> <li>武汉加油!</li> </ul> </body> </html> 2、遍历数组: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>数组遍历</title> <script type="text/javascript" src="../js/jquery-1.8.3.js" ></script> <script> $(function () { $.each([213,37,34,567

hdoj 第一题

拟墨画扇 提交于 2020-01-26 11:34:47
HD oj A+B problem Problem Description Calculate A + B. Input Each line will contain two integers A and B. Process to end of file. Output For each case, output A + B in one line. Sample Input 1 1 Sample Output 2 Source Code # include <stdio.h> int main ( ) { int a , b ; while ( scanf ( "%d%d" , & a , & b ) == 2 ) printf ( "%d\n" , a + b ) ; return 0 ; } 来源: CSDN 作者: 空荡荡的房间里学习 链接: https://blog.csdn.net/weixin_46179900/article/details/103981225

[翻译]你相信谁?

社会主义新天地 提交于 2020-01-25 19:11:46
在 InfoQ 上看到 一篇文章 ,讲了Linda Rising博士在敏捷开发2008大会上的演讲,题目是“你相信谁?”。这个演讲很有趣,或者用Linda Rising自己的话说,很怪异。 现在尝试翻译一下,不过这还不是终稿,个别词句仍需推敲。欢迎您多提宝贵意见。 " Who Do You Trust? " by Linda Rising 你相信谁?Linda Rising博士 During Agile 2008, Dr. Linda Rising held a presentation centered on experiments conducted many years ago, presenting how deep, powerfully affecting, and difficult to avoid are human “prejudices” and “stereotypes” as seen from the perspective of psychology and cognitive science. In the second half of the session, she explained how it is possible to minimize and overcome the impact of prejudice. This article

JQuery working with title and src attributes

风流意气都作罢 提交于 2020-01-25 18:42:30
问题 I am after a script that will onclick of a checkbox will get the src attribute of the input and then go through all the other checkboxes and radio buttons .each and remove the checked attribute of any inputs thats title attribute is is 'RQlevel' + this.src . Hope that is clear enough. Here is my attempt, however it is not correct. function levels() { if ($(this).is(':not(:checked)').each(function()) { if($(':input').attr('title', 'RQlevel' + this.src) { $(':input').removeAttr('checked'); });

JQuery working with title and src attributes

半世苍凉 提交于 2020-01-25 18:42:07
问题 I am after a script that will onclick of a checkbox will get the src attribute of the input and then go through all the other checkboxes and radio buttons .each and remove the checked attribute of any inputs thats title attribute is is 'RQlevel' + this.src . Hope that is clear enough. Here is my attempt, however it is not correct. function levels() { if ($(this).is(':not(:checked)').each(function()) { if($(':input').attr('title', 'RQlevel' + this.src) { $(':input').removeAttr('checked'); });

PHP学习(4)——数组的使用

烂漫一生 提交于 2020-01-25 04:52:35
1.数组的概念   数组就是一个用来存储一系列变量值的命名区域。   每个数组元素有一个相关的索引(也成为关键字),它可以用来访问元素。   PHP允许间隔性地使用数字或字符串作为数组的索引。 2.数字索引数组   2.1 数字索引数组的初始化 $products = array(‘Tires’,’Oil’,’Spark Plugs’);   如果需要将按升序排列的数字保存在一个数组中,可以使用range()函数自动创建这个数组。   创建一个1-10的数字数组: $numbers = range(1,10);   可选的第三个参数允许设定值之间的步幅。   创建一个1-10之间的奇数数组: $odds = range(1,10,2);   2.2 访问数组的内容   默认情况下,0元素是数组的第一个元素,使用$products[0]、$products[1]、$products[2],就可以使用数组$products的内容了。   除了访问,数组的内容可以修改和添加: $products[3] = ‘Fuses’;   像PHP的其他变量一样,数组不需要预先初始化或创建。在第一次使用它们的时候,它们会自动创建。   如下代码创建了一个与前面使用array()语句创建的$products数组相同的数组: $products[0] = ‘Tires’; $products[1] =

How to use after and each in conjunction to create a synchronous loop in underscore js

微笑、不失礼 提交于 2020-01-25 02:57:09
问题 Hi I'm trying to create a synchronous loop using underscore js. For each loop iteration I make some further asynchronous calls. However, I need to wait until each iteration call is finished before I move on to the next iteration. Is this possible in underscore js ? If yes, how so ? could someone please provide an example ? _.( items ).each( function(item) { // make aync call and wait till done processItem(item, function callBack(data, err){ // success. ready to move to the next item. }); //

杭电oj 1087——super jump!jump!jump(java实现)

大憨熊 提交于 2020-01-24 17:22:17
question:Super Jumping! Jumping! Jumping! 意思就是找一串数字中的和最大子串 思路:创建另一个数组,每一项是路径数组对应项之前最大子串的和,然后遍历此数组找出最大值即可(也是参考了别人的博客,下面是链接,这是接触的第一道dp题,希望慢慢的自己也会写!) 原文链接 source code: package hduoj; import java.util.Scanner; public class hdoj_1087 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true){ int count = sc.nextInt(); if(count==0) break; int[] path = new int[count]; for(int i = 0;i<count;++i){ path[i] = sc.nextInt(); } int[] each_maxmium = new int[count]; each_maxmium[0] = path[0]; for(int i = 1;i<count;++i){ each_maxmium[i] = path[i]; for(int j = 0;j<i;++j){ if

codeforces Round #610 E - The Cake Is a Lie

不问归期 提交于 2020-01-23 19:35:33
codeforces Round #610 E - The Cake Is a Lie 题目: https://codeforces.com/contest/1282/problem/E We are committed to the well being of all participants. Therefore, instead of the problem, we suggest you enjoy a piece of cake. Uh oh. Somebody cut the cake. We told them to wait for you, but they did it anyway. There is still some left, though, if you hurry back. Of course, before you taste the cake, you thought about how the cake was cut. It is known that the cake was originally a regular nn-sided polygon, each vertex of which had a unique number from 11 to nn. The vertices were numbered in random

jQuery .text() multiple elements same class

和自甴很熟 提交于 2020-01-23 12:36:11
问题 I'm attempting to use .text() on multiple (unknown number of) elements on a page. Consider: <ul> <li class="myClass">element1</li> <li class="myClass">element2</li> <li class="myClass">element3</li> </ul> $('.myClass').text(); Will return the first element's text "element1". I came across the following while looking around: $('.myClass').each(function(index, obj) { // do something }); However, this simply query returns each full elements like: <li class="myClass">element1</li> <li class=