本文发表在 rolia.net 枫下论坛I need to dynamically scroll down a select dropdown box in IE by javascript .
I found a Property scrollTop from msdn:
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/scrolltop.asp
tried the following code but it doesn't work in IE.
<script language="JavaScript">
<!--
function test()
{
//alert(document.all.s2); //s2 is a object.
document.all.s2.scrollTop +=20;
}
//-->
</script>
<table><tr><td>
<select id=s2 name=s2 size=6>
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
<option value=6>6</option>
<option value=7>7</option>
<option value=8>8</option>
<option value=9>9</option>
<option value=10>10</option>
<option value=11>11</option>
<option value=12>12</option>
<option value=13>13</option>
<option value=14>14</option>
<option value=15>15</option>
<option value=16>16</option>
</select>
</td>
<td><input type=button value=test onclick="Javascript:test()"></td>
</tr></table>
select's scrollTop in IE is always 0.My IE version is 6.0.28.
Surperisely the code is working in Firefox.
Since it's listed in MSDN, I suppose it should work in IE.
Thanks.更多精彩文章及讨论,请光临枫下论坛 rolia.net
I found a Property scrollTop from msdn:
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/scrolltop.asp
tried the following code but it doesn't work in IE.
<script language="JavaScript">
<!--
function test()
{
//alert(document.all.s2); //s2 is a object.
document.all.s2.scrollTop +=20;
}
//-->
</script>
<table><tr><td>
<select id=s2 name=s2 size=6>
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
<option value=6>6</option>
<option value=7>7</option>
<option value=8>8</option>
<option value=9>9</option>
<option value=10>10</option>
<option value=11>11</option>
<option value=12>12</option>
<option value=13>13</option>
<option value=14>14</option>
<option value=15>15</option>
<option value=16>16</option>
</select>
</td>
<td><input type=button value=test onclick="Javascript:test()"></td>
</tr></table>
select's scrollTop in IE is always 0.My IE version is 6.0.28.
Surperisely the code is working in Firefox.
Since it's listed in MSDN, I suppose it should work in IE.
Thanks.更多精彩文章及讨论,请光临枫下论坛 rolia.net