
<p><font color="#317eac" size="5" face="微软雅黑">Mail Settings</font></p>
<ul style="list-style-type:square">
<li><p>Overdue bugs Reminder Yes<input type="radio" value="Yes" name="pastDue"/>
No<input type="radio" value="No" name="pastDue" checked="checked"/></p></li>
<li><p>Bugs to Process Reminder Yes<input type="radio" value="Yes" name="aboutOf"/>
//加判断啊
No<input type="radio" value="No" name="aboutOf" checked="checked"/></p></li>
</ul>
<p id="location"><font size="3" face="微软雅黑">Will Overdue Bugs Reminder(Days):</font>
<select name='sldd' style='width:100pxheight: 25px'>
<option value="1" selected="selected">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>
</select>
</p>
<p id="searchs"><input type="button" value="Confirm" onclick="history_query()"/></p>
</form>
jsp下拉列表框默认显示查询的一条数据可以给select标签赋值,只取其中的一条数据即可。import java.util.ArrayList
import java.util.Iterator
public class Test{
ArrayList list
// constructorbuilds some sample data.
public Test(){
this.list = new ArrayList()
this.list.add(new String[]{"1", "January"})
this.list.add(new String[]{"2", "February"})
this.list.add(new String[]{"3", "March"})
this.list.add(new String[]{"4", "April"})
this.list.add(new String[]{"5", "May"})
this.list.add(new String[]{"6", "June"})
this.list.add(new String[]{"7", "July"})
this.list.add(new String[]{"8", "August"})
this.list.add(new String[]{"9", "September"})
this.list.add(new String[]{"10", "October"})
this.list.add(new String[]{"11", "November"})
this.list.add(new String[]{"12", "December"})
}
[B]
/**
* @return The months of the year as HTML Option tags.
* @param The number of the selected month as a string.
*/
public String getMonthAsOptions(String selectedMonth){
StringBuffer sb = new StringBuffer()
for(Iterator i = this.list.iterator()i.hasNext()){
String[] m = (String[])i.next()
String monthNumber = m[0]
String monthText = m[1]
sb.append("<option value=\"")
sb.append(monthNumber)
sb.append("\"")
if(monthNumber.equals(selectedMonth))
sb.append(" selected")
sb.append(">")
sb.append(monthText)
sb.append("</option>\n")
}
return sb.toString()
}
[/B]
// main method for testing and debugging only
public static void main(String[] args){
String selectedMonth = "4"
if(args.length >0)
selectedMonth = args[0]
Test test = new Test()
System.out.println(test.getMonthAsOptions(selectedMonth))
}
}
<option value="0" selected="selected">默认值</option>
要默认的 加上 selected="selected"。
<option selected="selected" value="<?php echo $result['genrename']?>"><?php echo $result['genrename']?></option>
默认的值是上个option得到的,程序中没有<option selected="selected" value="<s:property value='#cost.costcent'/>">的。
效果是如果yc的值等于0,select默认选中否,如果等于1,则默认选中是。
不使用控件。
拓展资料:
background-color是用来设置元素的背景颜色。
ex:
<div style="background-color:red width:200pxheight:200px"></div>。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)