m_astrWords[iCount].length == 0)
strPrompt += "[" + m_astrSenPart[iCount] + "]、";
strPrompt = strPrompt.slice(0, -1);
strPrompt += "部分单词个数为0";
strPrompt += "
操作将会产生" + iEmptyCnt + "个空文件";
strPrompt += ",您确定要这样做吗?";
}
if (window.confirm(strPrompt) == false) return;
}
frmWords.txtOpWay.value = "SAVEALL";
frmWords.submit();
}
//-----------------------------------------------------------
//从文件中载入所有类别的单词
function loadAll()
{
var iCount;
//------------------------------------------
//常变量说明
//iCount :计数器。整型
//------------------------------------------
//保存当前内存中所有的单词
for (iCount = 0; iCount < m_iPartCnt; iCount ++)
eval("frmWords.txtWords" + iCount).value = m_astrWords[iCount].join(",")
frmWords.txtOpWay.value = "LOADALL";
frmWords.submit();
}
//-----------------------------------------------------------
//进行词汇搭配,得到一个句子
function assemble()
{
var iCount, iWrdCnt, iRndIndex;
var strSentence;
//------------------------------------------
//常变量说明
//iCount :计数器。整型
//iWrdCnt :某类词汇单词的个数。整型
//iRndIndex :随机产生的单词索引。整型
//strSentence :由各个类别词汇中的随机单词组成的句子。字符串型
//------------------------------------------
strSentence = "";
for (iCount = 0; iCount < m_iPartCnt; iCount ++)
{
//如果当前类别词汇的个数为0
//给出提示,并中止搭配
iWrdCnt = m_astrWords[iCount].length;
if (iWrdCnt == 0)
{
var strPrompt;
//------------------------------------------
//常变量说明
//strPrompt :操作提示。字符串型
//------------------------------------------
strPrompt = "[" + m_astrSenPart[iCount] + "]部分一个可选单词也没有";
strPrompt += "
请至少输入一个单词";
alert(strPrompt);
txtWord[iCount].select();
return;
}
//随机抽取当前类别词汇中的一个单词
//加入到句子中
iRndIndex = Math.floor(Math.random()*iWrdCnt);
strSentence += m_astrWords[iCount][iRndIndex];
//alert("iWrdCnt: " + iWrdCnt + "
iRndIndex: " + iRndIndex);
}
strSentence += "。";
txtSentence.value = strSentence;
}
//使鼠标移到之处的按钮
//产生“点亮”的效果
function lightBtn()
{
var eleSrc;
//------------------------------------------
//常变量说明
//eleSrc :发生事件的元素
//------------------------------------------
eleSrc = window.event.srcElement;
while (eleSrc.tagName.toUpperCase() != "BUTTON")
eleSrc = eleSrc.parentElement;
eleSrc.className = "btnLighted";
}
//使鼠标离开的按钮
//还原为初始状态
function delightBtn()
{
var eleSrc;
//------------------------------------------
//常变量说明
//eleSrc :发生事件的元素
//------------------------------------------
eleSrc = window.event.srcElement;
while (eleSrc.tagName.toUpperCase() != "BUTTON")
eleSrc = eleSrc.parentElement;
eleSrc.className = "btnDelighted";
}
上一页 [1] [2]