这段代码有的地方不知道什么意思? with(document.all("idSel"))var sValue=options[selectedIndex].value;//等同于var sValue=document.all("idSel").options[selectedIndex].value;with没学过吗?with的用法在各种语言中大同小异吧? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 但是我把with(document.all("idSel"))var sValue=options[selectedIndex].value; 改为:var sValue=document.all("idSel").options[selectedIndex].value; 就出现错误:'document.all(...).options[...].value'为空或不是对象.. var sValue=document.all("idSel").options[document.all("idSel").selectedIndex].value; 但是我把with(document.all("idSel"))var sValue=options[selectedIndex].value; 改为:var sValue=document.all("idSel").options[selectedIndex].value; 就出现错误:'document.all(...).options[...].value'为空或不是对象.. -------------------------------------------------------------------selectedIndex是idSel滴属性,用with时没问题,瞎改当然就错了!要短滴这么写就行了,L@_@K<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <title> new document </title> <meta name="generator" content="editplus" /> <meta name="author" content="Gao YiXiang" /> <meta name="email" content="[email protected]" /> <meta name="keywords" content="javascript dhtml dom" /> <meta name="description" content="I love web development." /><style>#idDIV{width:100%;height:80px;background-color:#FFD700;padding:4px;font-family:verdana,tahoma;font-weight:bold;}</style></head><body> <script>function rdl_change(e){ var oDiv=document.all("idDiv"); oDiv.style.fontVariant=document.all("idSel").value;}</script><div id=idDIV> Every man dies , Not every man really lives . </div><br><select id="idSel" onchange="rdl_change();"><option value="normal"> ---font-variant---<option value="normal"> normal<option value="small-caps"> small-caps</select><br></body></html> 怎么旋转DIV 45度 要以中心旋转 js问题:页面中id重复了,取值时始终只能取得第一个值 采用jQuery获取样式表中的属性值 如何选中表的行和列 jq ui dialog bug function Dofromsite(addfromsite) 移动窗口没有错啊? 刷新页面的问题,急死我了!(一定付点!) ===========请教:如何实现Input(text类型)框中部分value的选中=========== 现在想取一列后的值 我叫什么名字 详细问题间内容描述
改为:var sValue=document.all("idSel").options[selectedIndex].value;
就出现错误:'document.all(...).options[...].value'为空或不是对象..
var sValue=document.all("idSel").options[document.all("idSel").selectedIndex].value;
改为:var sValue=document.all("idSel").options[selectedIndex].value;
就出现错误:'document.all(...).options[...].value'为空或不是对象..
-------------------------------------------------------------------
selectedIndex是idSel滴属性,用with时没问题,瞎改当然就错了!要短滴这么写就行了,L@_@K<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="Gao YiXiang" />
<meta name="email" content="[email protected]" />
<meta name="keywords" content="javascript dhtml dom" />
<meta name="description" content="I love web development." />
<style>
#idDIV{width:100%;height:80px;background-color:#FFD700;padding:4px;font-family:verdana,tahoma;font-weight:bold;}
</style>
</head>
<body>
<script>
function rdl_change(e)
{
var oDiv=document.all("idDiv");
oDiv.style.fontVariant=document.all("idSel").value;
}
</script><div id=idDIV> Every man dies , Not every man really lives . </div>
<br>
<select id="idSel" onchange="rdl_change();">
<option value="normal"> ---font-variant---
<option value="normal"> normal
<option value="small-caps"> small-caps
</select>
<br>
</body>
</html>