2014年3月18日 星期二
Regular expression in action
Write a form to send a query to Google maps. If the input is not in the format of coordinates, display an error and ask the user to retry. For example, an incorrect input may look like 12.a2,21.22
lab14
2014年3月11日 星期二
Using browsers for programming II
結果圖:
<html>
<head>
</head>
<body id="body">
<form action="javascript:void(0);" id="exampleForm">
<input type="password" id="examplePass" />
<input type="submit" />
</form>
</body>
<script>
document.getElementById("exampleForm").onsubmit = function(){
var passwordRegex = /^[\D]+[\W_]+[A-Za-z\d]{6,}$/;;
if(!passwordRegex.test(document.getElementById("examplePass").value)){
console.log("Regex didn't match");
var notify = document.getElementById("notify");
if (notify === null ){
notify =document.createElement("p");
notify.textContent = "長度必須至少六個字元,且必須至少包含一個數字以及一個非英文字母的字元"
notify.id="notify";
var body = document.getElementById("body");
body.appendChild(notify);
}
}
};
</script>
</html>
<html>
<head>
</head>
<body id="body">
<form action="javascript:void(0);" id="exampleForm">
<input type="password" id="examplePass" />
<input type="submit" />
</form>
</body>
<script>
document.getElementById("exampleForm").onsubmit = function(){
var passwordRegex = /^[\D]+[\W_]+[A-Za-z\d]{6,}$/;;
if(!passwordRegex.test(document.getElementById("examplePass").value)){
console.log("Regex didn't match");
var notify = document.getElementById("notify");
if (notify === null ){
notify =document.createElement("p");
notify.textContent = "長度必須至少六個字元,且必須至少包含一個數字以及一個非英文字母的字元"
notify.id="notify";
var body = document.getElementById("body");
body.appendChild(notify);
}
}
};
</script>
</html>
2014年3月10日 星期一
Using browsers for programming
程式碼:
<html>
<head>
</head>
<body id="body">
<form action="javascript:void(0);" id="exampleForm">
<input type="password" id="examplePass" />
<input type="submit" />
</form>
</body>
<script>
document.getElementById("exampleForm").onsubmit = function(){
var passwordRegex = /^[A-Za-z\d]{6,8}$/;
if(!passwordRegex.test(document.getElementById("examplePass").value)){
console.log("Regex didn't match");
var notify = document.getElementById("notify");
if (notify === null ){
notify =document.createElement("p");
notify.textContent = "Passwords need to be between 6 and 8 charcters long and consist of uppercase characters,lowercase charcters, and digits only"
notify.id="notify";
var body = document.getElementById("body");
body.appendChild(notify);
}
}
};
</script>
</html>
2014年3月3日 星期一
Using Chrome
一.http://www.cycu.edu.tw/
1.newsbox.jsp
2.runinfo.jsp
3.paper_photo2small.jsp
二.www.youtube.com
1.www.youtube.com
2.__utm.gif
3.GET /videoplayback?clen=463119&cpn=gUO-OHqdKUiSfw23&dur=32.800&expire=1393872109&fexp=906394%2C904833%2C914005%2C922920%2C941521%2C937417%2C937416%2C913434%2C936910%2C936913%2C902907%2C3300003%2C3300119%2C3300134%2C3300137%2C3300161%2C3310366%2C3310628%2C3310649&gir=yes&hightc=yes&id=o-AF2oG7JdgZMG2iFuHu12AFuWesNpfA3o9ZmVlBva6IpQ&ip=140.135.39.46&ipbits=0&itag=160&keepalive=yes&key=yt5&lmt=1393724071419894&ms=au&mt=1393850340&mv=m&range=221184-442367&ratebypass=yes&requiressl=yes&signature=97AF2ACA28EB025BF6A593954373AAA53A175FE2.6F65874C18E1BF63829203AFD40996CFA0792FAB&source=youtube&sparams=clen%2Cdur%2Cgir%2Chightc%2Cid%2Cip%2Cipbits%2Citag%2Clmt%2Crequiressl%2Csource%2Cupn%2Cexpire&sver=3&upn=ZJuRUu0jfbI HTTP/1.1 Host: r6---sn-5njj-u2xe.googlevideo.com Connection: keep-alive User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36 Accept: */* Referer: https://www.youtube.com/ Accept-Encoding: gzip,deflate,sdch Accept-Language: zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4
三.www.udacity.com
1.adsct?p_user_id=NDkyMTFiYjE5YzY4ZDY4MDkyNmMwYzQ2ZmYzYzM4NGM&p_id=823423
2.seg?add=789705&t=2
3.GET /pxj?bidder=172&seg=802787&action=setuid(%27NDkyMTFiYjE5YzY4ZDY4MDkyNmMwYzQ2ZmYzYzM4NGM%27) HTTP/1.1 Host: ib.adnxs.com Connection: keep-alive Accept: image/webp,*/*;q=0.8 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36 Referer: https://www.udacity.com/ Accept-Encoding: gzip,deflate,sdch Accept-Language: zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4 Cookie: uuid2=5763648886990887842; sess=1; anj=dTM7k!M4.g1IKunF7/.ij3qu#24lxXifH$='l^!75=Pj9++2qD<#S/.?DyWjsUJl.R-vjX=NZ8q*/0%u@e=Or
1.newsbox.jsp
2.runinfo.jsp
3.paper_photo2small.jsp
二.www.youtube.com
1.www.youtube.com
2.__utm.gif
3.GET /videoplayback?clen=463119&cpn=gUO-OHqdKUiSfw23&dur=32.800&expire=1393872109&fexp=906394%2C904833%2C914005%2C922920%2C941521%2C937417%2C937416%2C913434%2C936910%2C936913%2C902907%2C3300003%2C3300119%2C3300134%2C3300137%2C3300161%2C3310366%2C3310628%2C3310649&gir=yes&hightc=yes&id=o-AF2oG7JdgZMG2iFuHu12AFuWesNpfA3o9ZmVlBva6IpQ&ip=140.135.39.46&ipbits=0&itag=160&keepalive=yes&key=yt5&lmt=1393724071419894&ms=au&mt=1393850340&mv=m&range=221184-442367&ratebypass=yes&requiressl=yes&signature=97AF2ACA28EB025BF6A593954373AAA53A175FE2.6F65874C18E1BF63829203AFD40996CFA0792FAB&source=youtube&sparams=clen%2Cdur%2Cgir%2Chightc%2Cid%2Cip%2Cipbits%2Citag%2Clmt%2Crequiressl%2Csource%2Cupn%2Cexpire&sver=3&upn=ZJuRUu0jfbI HTTP/1.1 Host: r6---sn-5njj-u2xe.googlevideo.com Connection: keep-alive User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36 Accept: */* Referer: https://www.youtube.com/ Accept-Encoding: gzip,deflate,sdch Accept-Language: zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4
三.www.udacity.com
1.adsct?p_user_id=NDkyMTFiYjE5YzY4ZDY4MDkyNmMwYzQ2ZmYzYzM4NGM&p_id=823423
2.seg?add=789705&t=2
3.GET /pxj?bidder=172&seg=802787&action=setuid(%27NDkyMTFiYjE5YzY4ZDY4MDkyNmMwYzQ2ZmYzYzM4NGM%27) HTTP/1.1 Host: ib.adnxs.com Connection: keep-alive Accept: image/webp,*/*;q=0.8 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36 Referer: https://www.udacity.com/ Accept-Encoding: gzip,deflate,sdch Accept-Language: zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4 Cookie: uuid2=5763648886990887842; sess=1; anj=dTM7k!M4.g1IKunF7/.ij3qu#24lxXifH$='l^!75=Pj9++2qD<#S/.?DyWjsUJl.R-vjX=NZ8q*/0%u@e=Or
訂閱:
文章 (Atom)