本文发表在 rolia.net 枫下论坛<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Test</TITLE>
</HEAD>
<BODY>
<form name = "Test">
<TABLE>
<TR>
<TD>
<Select Name="Combo_1">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
</Select>
</TD>
</TR>
<TR>
<TD>
<Select Name="Combo_2">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
</Select>
</TD>
</TR>
<TR>
<TD>
<input type="Textbox" name="Result"></input>
</TD>
</TR>
<TR>
<TD>
<input type="Button" value="JavaScript" onClick="dowork_JavaScript();">
<input type="Button" value="vbScript" onClick="dowork_vbScript();">
</TD>
</TR>
</TABLE>
</form>
</BODY>
<script language="JavaScript">
function dowork_JavaScript()
{
var number1 = parseInt(document.Test.Combo_1.options[document.Test.Combo_1.selectedIndex].text);
var number2 = parseInt(document.Test.Combo_2.options[document.Test.Combo_2.selectedIndex].text);
document.Test.Result.value = number1 + number2
}
</script>
<script language="vbScript">
sub dowork_vbScript()
number1 = cint(document.Test.Combo_1.options(document.Test.Combo_1.selectedIndex).text)
number2 = cint(document.Test.Combo_2.options(document.Test.Combo_2.selectedIndex).text)
document.Test.Result.value = number1 + number2
end sub
</script>
</HTML>更多精彩文章及讨论,请光临枫下论坛 rolia.net
<HTML>
<HEAD>
<TITLE>Test</TITLE>
</HEAD>
<BODY>
<form name = "Test">
<TABLE>
<TR>
<TD>
<Select Name="Combo_1">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
</Select>
</TD>
</TR>
<TR>
<TD>
<Select Name="Combo_2">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
</Select>
</TD>
</TR>
<TR>
<TD>
<input type="Textbox" name="Result"></input>
</TD>
</TR>
<TR>
<TD>
<input type="Button" value="JavaScript" onClick="dowork_JavaScript();">
<input type="Button" value="vbScript" onClick="dowork_vbScript();">
</TD>
</TR>
</TABLE>
</form>
</BODY>
<script language="JavaScript">
function dowork_JavaScript()
{
var number1 = parseInt(document.Test.Combo_1.options[document.Test.Combo_1.selectedIndex].text);
var number2 = parseInt(document.Test.Combo_2.options[document.Test.Combo_2.selectedIndex].text);
document.Test.Result.value = number1 + number2
}
</script>
<script language="vbScript">
sub dowork_vbScript()
number1 = cint(document.Test.Combo_1.options(document.Test.Combo_1.selectedIndex).text)
number2 = cint(document.Test.Combo_2.options(document.Test.Combo_2.selectedIndex).text)
document.Test.Result.value = number1 + number2
end sub
</script>
</HTML>更多精彩文章及讨论,请光临枫下论坛 rolia.net