JQUERY
A simple site design by PHP and AJAX
View demo click here Download demo Home page
|
1 2 3 4 5 6 7 |
<ul id="navigation">
<li><a href="#page1">Page 1</a></li>
<li><a href="#page2">Page 2</a></li>
<li><a href="#page3">Page 3</a></li>
<li><a href="#page4">Page 4</a></li>
<li><img id="loading" src="img/ajax_load.gif" alt="loading" /></li>
</ul> |
|
1 2 |
<div id="pageContent">
Hello, this is a demo for a <a href="http://www.maning.ca/demo/php/ajax-site/" target="_blank">Ajax site sample</a>. To test it, click some of the buttons above. Have a nice stay!</div> |
JQUERY The .ready() method is generally incompatible with the attribute. If load must be used, either do not use .ready() or use jQuery’s .load() method to attach load event handlers to the window or to more specific items, like images. Note how, on line 3, [...]
Twitter and weibo example by PHP JQuery and AJAX
View demo click here Download demo Creating the DB If you’d like to run a working demo on your own site, you will have to create a MySQL table where all your tweets are going to be stored. You can run the following SQL code through phpMyAdmin (the code is also available in table.sql in [...]
Nice register form example with JQuery AJAX and PHP
View demo click here Download demo CSS
|
1 |
<link rel="stylesheet" type="text/css" href="demo.css" /> |
JQUERY
|
1 |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> |
Javascript
|
1 |
<script type="text/javascript" src="script.js"></script> |
Birthday html
|
1 2 3 4 5 |
<div class="input-container">
<select name="month"><option value="0">Month:</option><?=generate_options(1,12,'callback_month')?></select>
<select name="day"><option value="0">Day:</option><?=generate_options(1,31)?></select>
<select name="year"><option value="0">Year:</option><?=generate_options(date('Y'),1900)?></select>
</div> |
Birthday PHP function
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
function generate_options($from,$to,$callback=false)
{
$reverse=false;
if($from>$to)
{
$tmp=$from;
$from=$to;
$to=$tmp;
$reverse=true;
}
$return_string=array();
for($i=$from;$i<=$to;$i++)
{
$return_string[]='
<option value="'.$i.'">'.($callback?$callback($i):$i).'</option>
';
}
if($reverse)
{
$return_string=array_reverse($return_string);
}
return join('',$return_string);
}
function callback_month($month)
{
return date('M',mktime(0,0,0,$month,1));
} |
join(value,array) join function is use for join all array value to one, and separated by “value” array_reverse() — Return an array with elements in reverse order The last two styles are #loading and #error, which select [...]
JQuery Introduction, how works, example
jQuery is a JavaScript Library. jQuery greatly simplifies JavaScript programming. jQuery is easy to learn.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("p").click(function(){
$(this).hide();
});
});
</script>
</head>
<body>
<p>If you click on me, I will disappear.</p>
</body>
</html> |