分类:
2008-04-14 15:50:19
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>'; } 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>'; } |
display_history_buttons(); |
function display_history_buttons() { var str = ''; if (myHistory.hasPrev()) { str += '<a href="#" onclick="do_back(); return false;"> <img src="icons/back_on.gif" alt="Back" /></a>'; } else { str += '<img src="icons/back_off.gif" alt="" />'; } if (myHistory.hasNext()) { str += '<a href="#" onclick="do_forward(); return false;"> <img src="icons/forward_on.gif" alt="Forward" /></a>'; } else { str += '<img src="icons/forward_off.gif" alt="" />'; } str += '<a href="#" onclick="do_reload(); return false;"> <img src="icons/reload.gif" alt="Reload" /></a>'; document.getElementById("historybuttons").innerHTML = str; } |
function load_current() { // No existing history. if (myHistory.stack.length == 0) { x_get_table(to_window); myHistory.addResource('table-0-5'); // Load from history. } else { var current = myHistory.getCurrent(); var params = current.split('-'); if (params[0] == 'table') { x_get_table(params[1], params[2], to_window); } else if (params[0] == 'image') { x_get_image(params[1], to_window); } } } |
window.onload = function () { load_current(); }; |
function do_back() { myHistory.go(-1); load_current(); } function do_forward() { myHistory.go(1); load_current(); } function do_reload() { myHistory.go(0); } |
CHCurrent = 4 CHStack = table-0-5%2Cimage-1%2Cimage-2%2Cimage-3%2Ctable-3-5 |