代码是:
<form>
<div id="formWrap">
<h1 align="center" style="color:#0000FF" >B.E. Degree Course Registration</h1>
<div id="form">
<div class="row">
<div class="label0" style="color:#FF0000; font-style:italic; margin-left:20px; font-size:18px">Personel details:</div>
</div> <!-- end of 0th row -->
<div class="row">
<div class="label">Name</div>
<div class="input">
<input type="text" id="fullname" required="required" class="detail" name="fullname" />
</div>
<div class="label">Sex</div>
<div class="inputradio">
<input type="radio" id="radio" required="required" class="detailradio" name="sex" />
<span class="style7">Male</span>
<input type="radio" id="sex" required="required" class="detailradio" name="sex" />
<span class="style7">Female </span></div>
</div> <!-- end of first row -->
<div class="label3">ECA</div>
<div class="inputeca">
<select name="eca">
<option id="eca" required="required" class="ecadetail" value="eca1">NSS</option>
<option id="eca" required="required" class="ecadetail" value="eca2">NCC</option>
<option id="eca" required="required" class="ecadetail" value="eca3">Cultural</option>
</select>
</div>
<div class="label3">Year</div>
<div class="inputyear">
<script language="JavaScript"> <!-- start JS code hide
// loop to create the list
var year = 2012
document.write("<select name='years'>");
for (var i=1; i <=200; i++)
{
year++;
document.write("<option>" + year + "</option>");
}
// end JS code hide -->
</script>
<p></p>
</div>
</div> <!-- end of row -->
<table width="600" border="2">
<tr>
<td>col1</td>
<td>col2</td>
<td>col3</td>
<td>col5</td>
<td>col6</td>
</tr>
</table>
<div class="row">
<div class="submit" style="margin-left:708px">
<input type="submit" id="submit" name="submit" value="Proceed"/>
</div>
</div>
</div>
</div>
</form>
答案 0 :(得分:2)
变化:
<script language="JavaScript"> <!-- start JS code hide
// loop to create the list
var year = 2012
document.write("<select name='years'>");
for (var i=1; i <=200; i++)
{
year++;
document.write("<option>" + year + "</option>");
}
// end JS code hide -->
</script>
要
<select name="years">
<script language="JavaScript">
// loop to create the list
var year = 2012
for (var i=1; i <=200; i++)
{
year++;
document.write("<option>" + year + "</option>");
}
// end JS code hide -->
</script>
</select>
您不需要使用JS启动select
标记,而您忘记关闭标记,因此表格不会显示(可能还有其他内容)。
答案 1 :(得分:0)
您的脚本只是没有关闭select元素,因此该表位于select。
中<script language="JavaScript"> <!-- start JS code hide
// loop to create the list
var year = 2012
document.write("<select name='years'>");
for (var i=1; i <=200; i++)
{
year++;
document.write("<option>" + year + "</option>");
}
document.write("</select>")
// end JS code hide -->
这应该可以解决问题。
答案 2 :(得分:0)
您忘记关闭选择标记
<script language="JavaScript"> <!-- start JS code hide
// loop to create the list
var year = 2012
document.write("<select name='years'>");
for (var i=1; i <=200; i++)
{
year++;
document.write("<option>" + year + "</option>");
}
document.write("</select>");
// end JS code hide -->
</script>