词语搭配游戏的制作(ASP)三
来源:网络 责任编辑:栏目编辑 发表时间:2013-07-01 23:30 点击:次
//在列表中,使鼠标移到之处的单词
//产生“点亮”的效果
function lightOpt(ele)
{
var eleSrc;
//------------------------------------------
//常变量说明
//eleSrc :发生事件的元素
//------------------------------------------
eleSrc = ele;
eleSrc.className = "optLighted";
}
//在列表中,使鼠标离开的单词
//还原为初始状态
function delightOpt(ele)
{
var eleSrc;
//------------------------------------------
//常变量说明
//eleSrc :发生事件的元素
//------------------------------------------
eleSrc = ele;
eleSrc.className = "optDelighted";
}
//得到定义过的将加入列表的单词
function makeOpt(strWord, iWrdIdx)
{
var strOptHead, strOptFoot;
var strOptWord;
//------------------------------------------
//常变量说明
//strOptHead :重定义单词头。字符串型
//strOptFoot :重定义单词尾。字符串型
//strOptWord :重定义单词。字符串型
//------------------------------------------
strOptHead = "<div class=optDelighted onmouseover=lightOpt(this); onmouseout=delightOpt(this); ondblclick=removeOpt(this); wrdIdx=" + iWrdIdx + ">";
strOptFoot = "</div>";
strOptWord = strOptHead + strWord + strOptFoot;
//alert(strOptWord);
return strOptWord;
}
//删除列表中的单词
function removeOpt(ele)
{
var eleSrc;
var iIndex, iWrdIdx;
var astrWords, astrHead, astrFoot;
//------------------------------------------
//常变量说明
//eleSrc :发生事件的元素
//iIndex :表示词汇分类的数字。整型
//iWrdIdx :单词在单词数组中的索引。整型
//astrWords :某类词汇单词数组。字符串型数组
//astrHead :某类词汇单词数组头部分。字符串型数组
//astrFoot :某类词汇单词数组尾部分。字符串型数组
//------------------------------------------
eleSrc = ele;
iIndex = getEleIndex(eleSrc.parentElement);
iWrdIdx = parseInt(eleSrc.wrdIdx);
//将单词从词汇数组中删去
//showArray(m_astrWords[iIndex]);
astrWords = m_astrWords[iIndex].concat();
astrHead = astrWords.slice(0, iWrdIdx);
astrFoot = astrWords.slice(iWrdIdx + 1);
m_astrWords[iIndex] = astrHead.concat(astrFoot);
//showArray(astrHead);
//showArray(astrFoot);
//showArray(m_astrWords[iIndex]);
//将剩余的单词重新写入到页面中
valueList(m_astrWords[iIndex], iIndex);
txtWord[iIndex].select();
}
//-->
</script>
</head>
<body>
<!--标题-->
<div align="CENTER">
<span style="font-size: 20pt; font-weight: BOLD">词语搭配游戏</span>
<span class="fontEng2">v1.0</span>
</div>
<hr style="visibility: HIDDEN">
<!--主表格1-->
<table border="0" align="CENTER" width="80%">
<colgroup></colgroup>
<colgroup></colgroup>
<colgroup></colgroup>
<colgroup></colgroup>
<colgroup></colgroup>
<colgroup></colgroup>
<colgroup align="CENTER"></colgroup>
<colgroup></colgroup>
<%For m_iCount = 0 To (m_iPartCnt - 1)%>
<tr>
<td><%= m_astrSenPart(m_iCount)%></td>
<td width="20%"><input type="text" id="txtWord" style="width: 100%"></td>
<td><button id="btnGetWord" style="width: 75px" title="将单词保存到内存中">保存</button></td>
<td><button id="btnReset" style="width: 75px" title="从内存中删去当前类别所有的单词">重置</button></td>
<td><button id="btnSave" style="width: 75px" title="将单词保存到文件中">存入</button></td>
<td><button id="btnLoad" style="width: 75px" title="从文件中载入单词">载入</button></td>
//产生“点亮”的效果
function lightOpt(ele)
{
var eleSrc;
//------------------------------------------
//常变量说明
//eleSrc :发生事件的元素
//------------------------------------------
eleSrc = ele;
eleSrc.className = "optLighted";
}
//在列表中,使鼠标离开的单词
//还原为初始状态
function delightOpt(ele)
{
var eleSrc;
//------------------------------------------
//常变量说明
//eleSrc :发生事件的元素
//------------------------------------------
eleSrc = ele;
eleSrc.className = "optDelighted";
}
//得到定义过的将加入列表的单词
function makeOpt(strWord, iWrdIdx)
{
var strOptHead, strOptFoot;
var strOptWord;
//------------------------------------------
//常变量说明
//strOptHead :重定义单词头。字符串型
//strOptFoot :重定义单词尾。字符串型
//strOptWord :重定义单词。字符串型
//------------------------------------------
strOptHead = "<div class=optDelighted onmouseover=lightOpt(this); onmouseout=delightOpt(this); ondblclick=removeOpt(this); wrdIdx=" + iWrdIdx + ">";
strOptFoot = "</div>";
strOptWord = strOptHead + strWord + strOptFoot;
//alert(strOptWord);
return strOptWord;
}
//删除列表中的单词
function removeOpt(ele)
{
var eleSrc;
var iIndex, iWrdIdx;
var astrWords, astrHead, astrFoot;
//------------------------------------------
//常变量说明
//eleSrc :发生事件的元素
//iIndex :表示词汇分类的数字。整型
//iWrdIdx :单词在单词数组中的索引。整型
//astrWords :某类词汇单词数组。字符串型数组
//astrHead :某类词汇单词数组头部分。字符串型数组
//astrFoot :某类词汇单词数组尾部分。字符串型数组
//------------------------------------------
eleSrc = ele;
iIndex = getEleIndex(eleSrc.parentElement);
iWrdIdx = parseInt(eleSrc.wrdIdx);
//将单词从词汇数组中删去
//showArray(m_astrWords[iIndex]);
astrWords = m_astrWords[iIndex].concat();
astrHead = astrWords.slice(0, iWrdIdx);
astrFoot = astrWords.slice(iWrdIdx + 1);
m_astrWords[iIndex] = astrHead.concat(astrFoot);
//showArray(astrHead);
//showArray(astrFoot);
//showArray(m_astrWords[iIndex]);
//将剩余的单词重新写入到页面中
valueList(m_astrWords[iIndex], iIndex);
txtWord[iIndex].select();
}
//-->
</script>
</head>
<body>
<!--标题-->
<div align="CENTER">
<span style="font-size: 20pt; font-weight: BOLD">词语搭配游戏</span>
<span class="fontEng2">v1.0</span>
</div>
<hr style="visibility: HIDDEN">
<!--主表格1-->
<table border="0" align="CENTER" width="80%">
<colgroup></colgroup>
<colgroup></colgroup>
<colgroup></colgroup>
<colgroup></colgroup>
<colgroup></colgroup>
<colgroup></colgroup>
<colgroup align="CENTER"></colgroup>
<colgroup></colgroup>
<%For m_iCount = 0 To (m_iPartCnt - 1)%>
<tr>
<td><%= m_astrSenPart(m_iCount)%></td>
<td width="20%"><input type="text" id="txtWord" style="width: 100%"></td>
<td><button id="btnGetWord" style="width: 75px" title="将单词保存到内存中">保存</button></td>
<td><button id="btnReset" style="width: 75px" title="从内存中删去当前类别所有的单词">重置</button></td>
<td><button id="btnSave" style="width: 75px" title="将单词保存到文件中">存入</button></td>
<td><button id="btnLoad" style="width: 75px" title="从文件中载入单词">载入</button></td>
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>