词语搭配游戏的制作(ASP)三
程序员文章站
2022-11-18 12:35:14
//在列表中,使鼠标移到之处的单词//产生“点亮”的效果function lightopt(ele){var elesrc;//------------------------------...
//在列表中,使鼠标移到之处的单词
//产生“点亮”的效果
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 = "<p class=optdelighted onmouver=lightopt(this); onmouseout=delightopt(this); ondblclick=removeopt(this); wrdidx=" + iwrdidx + ">";
stroptfoot = "</p>";
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>
<!--标题-->
<p align="center">
<span style="font-size: 20pt; font-weight: bold">词语搭配游戏</span>
<span class="fonteng2">v1.0</span>
</p>
<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 = "<p class=optdelighted onmouver=lightopt(this); onmouseout=delightopt(this); ondblclick=removeopt(this); wrdidx=" + iwrdidx + ">";
stroptfoot = "</p>";
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>
<!--标题-->
<p align="center">
<span style="font-size: 20pt; font-weight: bold">词语搭配游戏</span>
<span class="fonteng2">v1.0</span>
</p>
<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>
上一篇: 擦这么多摩丝去勾引谁呀?
下一篇: 证能量