Linux中国 Linux中国门户站!
设为主页 设为主页
收藏本站 收藏本站
 
当前位置 :首页 ->编程语言 ->ASP ->正文

词语搭配游戏的制作(ASP)二

来源:Linuxdby.com 作者:Webmaster 时间:2007-04-24 点击: [收藏] [投稿]

}

//-----------------------------------------------------------
//隐藏词汇列表
function hideList(iIndex)
{
//如果未给定参数 iIndex
//获得 iIndex
if (iIndex == undefined)
{
//如果已有单词列表被固定,退出函数
if (m_iListFixed != -1) return;

var eleSrc;
var iIndex;

//------------------------------------------
//常变量说明
//eleSrc :发生事件的元素
//iIndex :表示词汇分类的数字。整型
//------------------------------------------

eleSrc = window.event.srcElement;
iIndex = getEleIndex(eleSrc);
}
//alert("iIndex: "+iIndex);

//隐藏词汇列表
//lblWordList[iIndex].innerText = lblWordList[iIndex].innerText.slice(0, -1);
lblWordList[iIndex].className = "lblMOut";
divWordList[iIndex].className= "listHidden";
}

//-----------------------------------------------------------
//固定词汇列表
function fixList()
{
var eleSrc;
var iIndex;

//------------------------------------------
//常变量说明
//eleSrc :发生事件的元素
//iIndex :表示词汇分类的数字。整型
//------------------------------------------

eleSrc = window.event.srcElement;
iIndex = getEleIndex(eleSrc);



switch (m_iListFixed)
{
case -1:
//如果还没有单词列表被固定
//固定当前列表
m_iListFixed = iIndex;
lblWordList[iIndex].className = "lblClicked";
divWordList[iIndex].className= "listFixed";
break;

case iIndex:
//如果被固定单词列表是当前列表
//解固当前列表
m_iListFixed = -1;
lblWordList[iIndex].className = "lblMOver";
divWordList[iIndex].className= "listShown";
break;

default:
//如果被固定单词列表不是当前列表
//解固被固定列表
hideList(m_iListFixed);
m_iListFixed = -1;
lblWordList[iIndex].className = "lblMOver";
showList(iIndex);
break;
}

//alert("m_iListFixed: " + m_iListFixed + "\niIndex: " + iIndex);
}

//-----------------------------------------------------------
//写入某类词汇已载入的单词
function valueList(aWords, iSenPart)
{
var iCount, iWrdCnt;
var strListPpt;

//------------------------------------------
//常变量说明
//iCount :计数器。整型
//iWrdCnt :某类词汇单词的数目。整型

//strListPpt :单词列表中的提示。字符串型
//------------------------------------------

//数据准备
iWrdCnt = aWords.length;
lblWordCount[iSenPart].innerText = iWrdCnt;
strListPpt = "<div><span style='color: RED; font-style: Italic; font-size: 10.5pt;'>";
strListPpt += "双击单词将其删除</span></div>";

//将单词写入列表
if (iWrdCnt != 0)
{
divWordList[iSenPart].innerHTML = strListPpt;
for (iCount = 0; iCount < iWrdCnt; iCount ++)
divWordList[iSenPart].innerHTML += makeOpt(aWords[iCount], iCount);
}
else
divWordList[iSenPart].innerHTML = strListPpt;
}

//-----------------------------------------------------------
//显示帮助列表
function showHelp()
{
//如果帮助列表已被固定,退出函数
if (m_iHelpFixed == 0) return;

//显示帮助
lblHelp.className = "lblMOver";
divHelp.className = "helpShown";
}

//-----------------------------------------------------------
//隐藏帮助列表
function hideHelp()
{
//如果帮助列表已被固定,退出函数
if (m_iHelpFixed == 0) return;

//隐藏帮助
lblHelp.className = "lblMOut";
divHelp.className = "helpHidden";
}

//-----------------------------------------------------------
//固定帮助列表
function fixHelp()
{
if (m_iHelpFixed == -1)
{
//如果帮助列表还未被固定
//固定它
m_iHelpFixed = 0;
lblHelp.className = "lblClicked";
divHelp.className = "helpFixed";
}
else
{
//如果帮助列表已被固定
//解固它
m_iHelpFixed = -1;
lblHelp.className = "lblMOver";
divHelp.className = "helpShown";
}
}

//-----------------------------------------------------------
//重置页面至初始状态
function resetAll()
{
var iCount;
//------------------------------------------
//常变量说明
//iCount :计数器。整型
//------------------------------------------

for (iCount = 0; iCount < m_iPartCnt; iCount ++)
{
txtWord[iCount].value= "";
m_astrWords[iCount] = new Array(); //将单词数组清空
valueList(m_astrWords[iCount], iCount);

}

txtSentence.value = "";
txtWord[0].focus();
}

//-----------------------------------------------------------
//把所有类别的单词都存入文件
function saveAll()
{
var iCount, iEmptyCnt;
var strPrompt;

//------------------------------------------
//常变量说明
//iCount :计数器。整型
//iEmptyCnt :单词数目为0的类别个数。整型
//strPrompt :操作提示。字符串型
//------------------------------------------

iEmptyCnt = 0;
for (iCount = 0; iCount < m_iPartCnt; iCount ++)
{
//保存当前内存中所有的单词
eval("frmWords.txtWords" + iCount).value = m_astrWords[iCount].join(",");
if (m_astrWords[iCount].length == 0)

 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<



上一篇:词语搭配游戏的制作(ASP)一   下一篇:词语搭配游戏的制作(ASP)三

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章
Power by linux-cn.com 粤ICP备05006655号