解决方案 »
- javascript中的window对象
- 请问一个java脚本的问题!
- 帮忙看下这JS 有什么问题
- 请教在使用innerHTML后如何在查看源代码里显示添加的代码!
- confirm弹出对话框后,如果用户3秒不做选择,就认为它点击了确定
- 如何给MediaPlayer增加播放列表? 这个是不是有点战呢?
- 请教怎么样将javascript中的变量赋值给javascript中java中的变量,多谢指教!
- setTimeout问题,请进!!!
- 在表单里,能否用单选钮去控制别的控件的属性?
- 请教:如何让秋水的这段代码变成向下滚动?!~
- 关于JQUERY在IE6下的bug问题
- extjs中的thiz指的是什么呢?
var selectSecond = $("#SelectSecond");修改为
var selectSecond = $("#<%=SelectSecond.ClientID %>");
function createTag(parentTagId, childTag){
var thisObj=document.createElement(childTag);
var parent =document.getElementById(parentTagId);
parent.appendChild(thisObj);
return thisObj;
}
........
if (data) {
var jsonObject=eval("("+data.Table+")"); //转换返回的josn数组,使其变为可操作对象
var selectSecond = $("#SelectSecond");
selectSecond.empty();
for(var obj in jsonObject){
var createObj = createTag('SelectSecond', 'option');
createObj.innerHTML = obj;
createObj.value = jsonObject[obj];
}
}
Microsoft JScript 运行时错误: 缺少 ']'
{
selectSecond.options.add(Opt, null); // standards compliant
}
catch(ex)
{
selectSecond.options.add(Opt); // IE only
}
}
selectSecond.options在这里 提示获取不到 options这属性啊undefined
<select id="SelectSecond1" onchange="selected()"></select>
<script>
//模拟数据
d = [
{numbers:1, notects:'a'},
{numbers:2, notects:'b'},
{numbers:3, notects:'c'}
];//jquery 写法
$.each(d, function(i, t) {
$("<option value='"+t.numbers+"'>"+t.notects+"</option>").appendTo($('#SelectSecond'));
});//js 写法
for(i=0; i<d.length; i++) {
o = new Option(d[i].notects, d[i].numbers);
document.getElementById('SelectSecond1').options[i] = o;
}
</script>
selectSecond.options在这里 提示获取不到 options这属性啊undefined
不好意思,我写错了,应该是 try
{
selectSecond.add(Opt, null); // standards compliant
}
catch(ex)
{
selectSecond.add(Opt); // IE only
}
}
你再试试,绝对可以的。