<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input type" />
<select style="color: rgb(22,223,0);" id="sel">
<option style="color:black;" value="11">1</option>
<option value="22">2</option>
<option value="33">3</option>
</select>
<input id="myCar" list="cars" />
<datalist id="cars">
<option value="BMW">
<option value="Ford">
<option value="Volvo">
</datalist>
<script>
var datalist=document.getElementById("cars");
</script>
</body>
<script>
window.οnlοad=function(){
var sel=document.getElementById("sel");
var chil=sel.children;
for(var i=0;i<chil.length;i++){
if(chil[i].text=="3"){
chil[i].setAttribute("selected","selected")
};
}
console.log(sel.children)
}
</script>
<script>
// $("#sel>option:selected").val();
// $("#sel option:selected").text();
// $("#sel").find("option:selected");
// $('#sel').get(0).selectedindex;
// <input maxlength="value">
// 其中“value”表示输入字段中允许的最大字符数。
//
// <input type="text" name="email" size="35" /></p>
// 定义和用法
// size 属性规定输入字段的宽度。
// 对于 <input type="text"> 和 <input type="password">,
// size 属性定义的是可见的字符数。而对于其他类型,size 属性定义的是以像素为单位的输入字段宽度。
// 兼容性提示
// 由于 size 属性是一个可视化的设计属性,我们推荐您使用 CSS 来代替它。
// CSS 语法:<input style="width:100px" />
</script>
</html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input type" />
<select style="color: rgb(22,223,0);" id="sel">
<option style="color:black;" value="11">1</option>
<option value="22">2</option>
<option value="33">3</option>
</select>
<input id="myCar" list="cars" />
<datalist id="cars">
<option value="BMW">
<option value="Ford">
<option value="Volvo">
</datalist>
<script>
var datalist=document.getElementById("cars");
</script>
</body>
<script>
window.οnlοad=function(){
var sel=document.getElementById("sel");
var chil=sel.children;
for(var i=0;i<chil.length;i++){
if(chil[i].text=="3"){
chil[i].setAttribute("selected","selected")
};
}
console.log(sel.children)
}
</script>
<script>
// $("#sel>option:selected").val();
// $("#sel option:selected").text();
// $("#sel").find("option:selected");
// $('#sel').get(0).selectedindex;
// <input maxlength="value">
// 其中“value”表示输入字段中允许的最大字符数。
//
// <input type="text" name="email" size="35" /></p>
// 定义和用法
// size 属性规定输入字段的宽度。
// 对于 <input type="text"> 和 <input type="password">,
// size 属性定义的是可见的字符数。而对于其他类型,size 属性定义的是以像素为单位的输入字段宽度。
// 兼容性提示
// 由于 size 属性是一个可视化的设计属性,我们推荐您使用 CSS 来代替它。
// CSS 语法:<input style="width:100px" />
</script>
</html>