Created
November 16, 2014 09:03
-
-
Save tomoTaka01/9c97c9c1bedc08b5f991 to your computer and use it in GitHub Desktop.
just some sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>sample</title> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<script src="./js/vendor/jquery-1.11.1.js"></script> | |
<script src="./js/vendor/jquery-cookie/jquery.cookie.js"></script> | |
<script> | |
$(document).ready(function(){ | |
$('#testBtn').click(function(){ | |
$("#result").text("test button licked!"); | |
}); | |
for (var i=0;i <3; i++){ | |
$('#infoList').append("<a href='info.html' name='infoName' id='id" + i + "'><li>info + " + i + "</li></a>"); | |
} | |
var array1 = ["array1", "array2"]; | |
for (var i =0; i< array1.length; i++){ | |
console.log(array1[i]); | |
} | |
function printEle(ele){ | |
console.log("ele:" + ele); | |
} | |
array1.forEach(printEle); | |
$('*[name=infoName]').each(function(){ | |
this.href = "info" + this.id + ".html"; | |
}); | |
$(navigator).each( | |
function(){ | |
console.log(this); | |
}); | |
$.each(navigator, function(key, ele){ | |
console.log("key:" + key + ",ele:" + ele); | |
if (ele === null){ | |
$("#naviList").append("<li>navigator key:" + key + ",value:null</li>"); | |
} else { | |
$("<li>navigator key:" + key + ",value:" + ele.toString() + "</li>").appendTo($("naviList")); | |
$("#naviList").append("<li>navigator key:" + key + ",value:" + ele.toString() + "</li>"); | |
} | |
}); | |
$("#saveCookie").on("click", function(){ | |
var key = $("#cookieKey").val(); | |
var val = $("#cookieVal").val(); | |
$.cookie(key, val, {expires:7}); | |
}); | |
$("#getCookie").click(function(){ | |
var key = $("#cookieKey").val(); | |
var val = $.cookie(key); | |
$("#result").text("cookie val:" + val); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<div><output id="result"> </output></div> | |
<input id="testBtn" type="button" value="test"/> | |
<div> | |
<label for="cookieKey">cookie key:</label> | |
<input type="text" id="cookieKey"/> | |
<label for="cookieVal">cookie value:</label> | |
<input type="text" id="cookieVal"/> | |
<input id="saveCookie" type="button" value="save cookie"/> | |
<input id="getCookie" type="button" value="get cookie"/> | |
</div> | |
<ul id="infoList"></ul> | |
<ul id="naviList"></ul> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment