| エンタープライズ:特集 | 2003/07/01 15:46:00 更新 |
JAVA Developer 2003年8月号より転載
FlashとTomcatで実現する使いたくなるWebアプリ (5/10)
(2)ページ遷移の制御(リスト5)
ページ遷移の制御は、現在のページの入力内容を保存、次ページの表示内容を準備、次ページに相当するフレームへジャンプという流れになります。実際には、saveTextInput、saveSelect、saveCheckboxで現在の入力内容をチェックして保存し、setupPageで次ページの準備とページ遷移を行っています。
| リスト5 ページ遷移の制御(フレームスクリプト内) |
function setupPage()
{
current_questionnaire = extractGroupedElements (
config, "root.questionnaire[" + q_index + "].");
// dumpProperties (current_questionnaire);
reply_method = current_questionnaire["reply-method"] ;
changePage(reply_method);
_root.message_text.text = "";
var q = current_questionnaire["question"];
q = fixQuestion (q);
question_text.text = q;
var is_top = (q_index == 0);
_level0.prev_button.setEnabled (! is_top);
}
function fixQuestion (q)
{
s = q;
var x = s.indexOf ("{$");
if (x == -1) return q;
var q1 = (x > 0 ? s.substring (0, x) : "");
var y = s.indexOf ("}", x);
var r = s.substring (x + 2, y);
var q2 = s.slice (y + 1);
ra = r.split ("(");
if (ra[0].split (" ")[0].toLowerCase() == "result")
{
var index = int (ra[1]);
return q1 + result[index].display + q2;
}
return q;
}
function changePage(pagename)
{
_root.gotoAndStop(pagename+ "_page");
}
function getIndex()
{
return q_index;
}
function goNext()
{
q_index++;
var id = config["root.questionnaire[" + q_index + "].id"];
if (id === undefined)
_root.gotoAndStop ("thanx");
else
setupPage();
}
function goBack()
{
q_index--;
var id = config["root.questionnaire[" + q_index + "].id"];
if (id === undefined)
_root.gotoAndStop ("thanx");
else
setupPage();
}
|
前のページ | 1 2 3 4 5 6 7 8 9 10 | 次のページ
[佐藤 毅,JAVA Developer]
Copyright © ITmedia, Inc. All Rights Reserved.
