【php开源代码栏目提醒】:网学会员--在 php开源代码编辑为广大网友搜集整理了:36.1.index.php绩等信息,祝愿广大网友取得需要的信息,参考学习。
<?
require("36.1.Sajax.php");
// Library shared by Sajax and non-Sajax pages
require("36.1.lib_photo_gallery.php");
/*
* Create a link to the pager table
*/
function get_table_link ( $title, $start, $step ) {
$link = "myHistory.addResource('table-$start-$step'); "
."x_get_table($start, $step, to_window); "
."return false;";
return '<a href="#" onclick="' . $link . '">' . $title .'</a>';
}
/*
* Create a link for the user to click on which blows up an image
*/
function get_image_link ( $title, $index ) {
$link = "myHistory.addResource('image-$index'); "
."x_get_image($index, to_window); "
."return false;";
return '<a href="#" onclick="' . $link . '">' . $title . '</a>';
}
// Standard Sajax stuff. Use Get, and export two main functions to javascript
$sajax_request_type = "GET";
s
ajax_init();
sajax_export("get_image", "get_table");
sajax_handle_client_request();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>创建简单的相册</title>
<meta http-equiv="Content-Type" content="text/html;charset=zh-gb2312">
<style type="text/css">
body { text-align: center }
div#window { margin: 0 auto 0 auto; width: 700px; padding: 10px; border: 1px solid #ccc; background: #eee; }
div#meta_data { margin: 0 auto 0 auto; width: 300px; font-size: small; }
table.image_table { margin: 0 auto 0 auto; }
table.image_table td { padding: 5px }
table.image_table a { display: block; }
table.image_table img { display: block; width: 120px; padding: 2px; border: 1px solid #ccc; }
img.full { display: block; margin: 0 auto 0 auto; width: 300px; border: 1px solid #000 }
#historybuttons { text-align:left; margin: 0 auto 0 auto; width: 700px; padding: 10px; border: 1px solid #ccc; }
#historybutton img { border:none; margin-right:5px; }
</style>
<script type="text/javascript">
/**
* HistoryStack
*
* A
JavaScript object for storing resources or identifiers in a
* history stack. The history lasts as long as the browser is
* open (i.e. session cookie).
*
* Written by Mike Brittain for IBM developerWorks.
*/
/**
* Constructor
*/
function HistoryStack ()
{
/** Current stack loaded in memory, which will also be
cached to cookies. */
this.stack = new Array();
/** Pointer to current location in the history stack. */
this.current = -1;
/** Max size of the history stack. */
this.stack_limit = 15;
}
/**
* Return the name of the current resource in the
* history stack.
*/
HistoryStack.prototype.getCurrent = function ()
{
return this.stack[this.current];
};
/**
* Add the resource to the next position after the "current" pointer.
* If there are items existing past current, they will first be cut
* off the end of the stack. The stack will also be truncated to
* "stack_limit" if it has grown to large.
*/
HistoryStack.prototype.addResource = function(resource)
{
if (this.stack.length > 0) {
this.stack = this.stack.slice(0, this.current + 1);
}
this.stack.push(resource);
while (this.stack.length > this.stack_limit) {
this.stack.shift();
}
this.current = this.stack.length - 1;
this.save();
};
/**
* Handle navigation within the history stack. Any negative argument
* will go backwards in the stack and positive arguments will go
* forward. If zero is passed to the method, the page will be
* reloaded.
*/
HistoryStack.prototype.go = function(increment)
{
// Go back...
if (increment < 0) {
this.current = Math.max(0, this.current + increment);
// Go forward...
} else if (increment > 0) {
this.current = Math.min(this.stack.length - 1,
this.current + increment);
// Reload...
} else {
location.reload();
}
this.save();
};
/**
* Returns boolean value whether there is a previous
* entry in the history stack.
*/
HistoryStack.prototype.hasPrev = function()
{
return (this.current > 0);
};
/**
* Returns boolean value whether there is a suceeding
* entry in the history stack.
*/
HistoryStack.prototype.hasNext = function()
{
return (this.current < this.stack.length - 1
&& this.current > -1);
};
/**
* Save the current history stack and pointer to cookies
*/
HistoryStack.prototype.save = function()
{
this.setCookie('CHStack', this.stack.toString());
this.setCookie('CHCurrent', this.current);
};
/**
* Load the history stack and pointer from cookies.
*/
HistoryStack.prototype.load = function()
{
var tmp_stack = this.getCookie('CHStack');
if (tmp_stack != '') {
this.stack