Wednesday, December 24, 2014
Friday, September 12, 2014
CSS transform AND jquery animate
<style>
#aa{
width:100%;
height:100%;
background: url('http://33.media.tumblr.com/f23c9636cd9fe74fa473492fa3d9f2d0/tumblr_nbru71s6AD1tlk8p6o1_500h.jpg') 0 0 no-repeat;
text-indent: 980px;
}
</style>
<!--<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>>-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$( "#aa" ).animate({
textIndent:0
}, {
duration: 5000,
step: function( now, fx ) {
$(this).css('transform','rotateX(' + now +'deg)')
$(this).css('transform', 'translate3d('+now+','+now+','+now+')');
//$(this).css('transform','rotateY(' + now +'deg)')
var data = fx.elem.id + " " + fx.prop + ": " + now;
$( "body" ).append( "<div>" + data + "</div>" );
}
});
})
</script>
<div id='aa'>
</div>
Monday, May 19, 2014
Json header and encode for PHP
link source: http://stackoverflow.com/questions/4064444/returning-json-from-a-php-script
PHP對JSON編碼後,送回去的資料型態利用header定義好再送回。$data = array('a'=>array(1,2,3,4,5,6),'b'=>'bcd')/** whatever you're serializing **/; header('Content-Type: application/json'); echo json_encode($data);
Tuesday, May 13, 2014
Same-origin policy fro javascript
同源政策,cross browser ajax的處理方式
1. put below in your .php file 2.use jsonp as following $.ajax({ url: 'http://...................., crossDomain: true, dataType: 'jsonp', data:{ uname: $('input#A1').val(), uphone: $('input#A2').val(), uemail: $('input#A3').val(), callback: json_callback } }).done(function(data){ });
Thursday, March 27, 2014
Sunday, February 23, 2014
RegExp javascirpt php
http://www.w3schools.com/php/php_form_url_email.asp
1.javascript exmple:
1.1
var str = "Visit W3Schools";
var patt1 = /w3schools/i;
var result = str.match(patt1);
1.2 if only return true / false
1.javascript exmple:
1.1
var str = "Visit W3Schools";
var patt1 = /w3schools/i;
var result = str.match(patt1);
1.2 if only return true / false
var patt1=new RegExp("e");
document.write(patt1.test("The best things in life are free"));
2.php exmple:
document.write(patt1.test("The best things in life are free"));
2.php exmple:
2.2
$email = test_input($_POST["email"]);
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$email))
{
$emailErr = "Invalid email format";
}
3.RegExpemail: /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/i
URL:/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$email))
{
$emailErr = "Invalid email format";
}
3.RegExpemail: /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/i
URL:/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i
Saturday, February 22, 2014
PHP setting in eginx
source: http://www.cyberciti.biz/faq/freebsd-install-nginx-webserver/
- Nginx Default configuration file: /usr/local/etc/nginx/nginx.conf
- Nginx Default http / https port: 80 / 443
- Nginx Default error log file: /var/log/nginx-error.log
- Nginx Default access log file: /var/log/nginx-access.log
- Nginx Default DocumentRoot: /usr/local/www/nginx/
Subscribe to:
Posts (Atom)