关于一个dojo.widget.byId取div的问题。
/**
*弹出状态描述勾选层
*/
function showBox(id){
$( "#descriptionTab ").html( " ");
//渲染状态表述表
var array=${array};
var ids=$( "#ids_ "+id).val();
//如果还未勾选状态,默认选中S级
$(array).each(function(i,obj){
if(obj.id==id){
if(obj.array!=undefined&&obj.array.length> 0){
var str= " ";
$(obj.array).each(function(j,temp){
var descriptionStr= " ";
//单选模式
if(temp.array!=undefined&&temp.array.length> 0){
$(temp.array).each(function(k,o){
if(k==0){
descriptionStr+= " <input id= ' "+o.id+ " ' type= 'radio ' name= ' "+temp.id+ " ' value = ' "+o.name+ " ' checked= 'checked '/> <span> "+o.description+ " </span> <br/> "
}else{
descriptionStr+= " <input id= ' "+o.id+ " ' type= 'radio ' name= ' "+temp.id+ " ' value = ' "+o.name+ " '/> <span> "+o.description+ " </span> <br/> "
}
});
}
str+= " <tr> <td style= 'padding-left:5px;padding-right:5px '> "+temp.description+ " </td> <td style= 'padding-left:5px;padding-right:5px; '> "+descriptionStr+ " </td> </tr> "
});
$( "#descriptionTab ").html(str);
}
}
});
if(ids!= " "){
var idStr=ids.split( "; ");
for(var n=0;n <idStr.length;n++){
if(idStr[n]!= " "){
$( "# "+idStr[n]).attr( "checked ", "true ");
}
}
}
//给确定按钮绑定单击事件
$( "#submit ").bind( "click ",{id:id},updateResult);
dlg = dojo.widget.byId( "DialogContent "); ----> > > 无法取到值
alert( "a: "+dojo.widget.byId( "DialogContent "));
dlg.show();
}
function updateResult(event){
id=event.data.id;
var ids= " ";
var str= " ";
$( "#descriptionTab ").find( "input[type= 'checkbox '][checked= 'true '] ").each(function(i,obj){
ids+=$(obj).attr( "id ")+ "; ";
i++;
var span=$(obj).next();
if(span.is( "span ")){
if(i==1){
str+=i+ "、 "+span.html();
}else{
str+= " "+i+ "、 "+span.html();
}
}
});
$( "#ids_ "+id).val(ids);
if(str.length> 16){
$( "#description_ "+id).html(str.substring(0,16)+ "... ");
}else{
$( "#description_ "+id).html(str);
}
$( "#description_ "+id).next().val(str);
$( "#description_ "+id).attr( "title ",str);
dlg.hide();
}
div层
<div dojoType= "Dialog " id= "DialogContent " isContainer= "true " bgColor= "white " bgOpacity= "0.5 " toggle= "fade " toggleDuration= "250 " style= "display:none " closeNode= "hider " closeOnBackgroundClick= "true ">
<table class= "maintable " style= "width:800px ">
<tr>
<td class= "maintable_Head "> 编辑检查内容 </td>
</tr >
<tr>
<td >
<table width= "100% ">
<thead>
<tr>
<td align= 'center ' width= "50% "> <b> 检查项目 </b> </td>
<td align= 'center ' width= "50% "> <b> 主要检查内容 </b> </td>
</tr>
</thead>
<tbody id= "descriptionTab "> </tbody>
</table>
</td>
</tr>
<tr>
<td align= "center ">
<input type= "button " id= "submit " value= "确 定 " class= "button "/>
<input type= "button " id= "hider " value= "取 消 " class= "button "/>
</td>
</tr>
</table>
</div>
*弹出状态描述勾选层
*/
function showBox(id){
$( "#descriptionTab ").html( " ");
//渲染状态表述表
var array=${array};
var ids=$( "#ids_ "+id).val();
//如果还未勾选状态,默认选中S级
$(array).each(function(i,obj){
if(obj.id==id){
if(obj.array!=undefined&&obj.array.length> 0){
var str= " ";
$(obj.array).each(function(j,temp){
var descriptionStr= " ";
//单选模式
if(temp.array!=undefined&&temp.array.length> 0){
$(temp.array).each(function(k,o){
if(k==0){
descriptionStr+= " <input id= ' "+o.id+ " ' type= 'radio ' name= ' "+temp.id+ " ' value = ' "+o.name+ " ' checked= 'checked '/> <span> "+o.description+ " </span> <br/> "
}else{
descriptionStr+= " <input id= ' "+o.id+ " ' type= 'radio ' name= ' "+temp.id+ " ' value = ' "+o.name+ " '/> <span> "+o.description+ " </span> <br/> "
}
});
}
str+= " <tr> <td style= 'padding-left:5px;padding-right:5px '> "+temp.description+ " </td> <td style= 'padding-left:5px;padding-right:5px; '> "+descriptionStr+ " </td> </tr> "
});
$( "#descriptionTab ").html(str);
}
}
});
if(ids!= " "){
var idStr=ids.split( "; ");
for(var n=0;n <idStr.length;n++){
if(idStr[n]!= " "){
$( "# "+idStr[n]).attr( "checked ", "true ");
}
}
}
//给确定按钮绑定单击事件
$( "#submit ").bind( "click ",{id:id},updateResult);
dlg = dojo.widget.byId( "DialogContent "); ----> > > 无法取到值
alert( "a: "+dojo.widget.byId( "DialogContent "));
dlg.show();
}
function updateResult(event){
id=event.data.id;
var ids= " ";
var str= " ";
$( "#descriptionTab ").find( "input[type= 'checkbox '][checked= 'true '] ").each(function(i,obj){
ids+=$(obj).attr( "id ")+ "; ";
i++;
var span=$(obj).next();
if(span.is( "span ")){
if(i==1){
str+=i+ "、 "+span.html();
}else{
str+= " "+i+ "、 "+span.html();
}
}
});
$( "#ids_ "+id).val(ids);
if(str.length> 16){
$( "#description_ "+id).html(str.substring(0,16)+ "... ");
}else{
$( "#description_ "+id).html(str);
}
$( "#description_ "+id).next().val(str);
$( "#description_ "+id).attr( "title ",str);
dlg.hide();
}
div层
<div dojoType= "Dialog " id= "DialogContent " isContainer= "true " bgColor= "white " bgOpacity= "0.5 " toggle= "fade " toggleDuration= "250 " style= "display:none " closeNode= "hider " closeOnBackgroundClick= "true ">
<table class= "maintable " style= "width:800px ">
<tr>
<td class= "maintable_Head "> 编辑检查内容 </td>
</tr >
<tr>
<td >
<table width= "100% ">
<thead>
<tr>
<td align= 'center ' width= "50% "> <b> 检查项目 </b> </td>
<td align= 'center ' width= "50% "> <b> 主要检查内容 </b> </td>
</tr>
</thead>
<tbody id= "descriptionTab "> </tbody>
</table>
</td>
</tr>
<tr>
<td align= "center ">
<input type= "button " id= "submit " value= "确 定 " class= "button "/>
<input type= "button " id= "hider " value= "取 消 " class= "button "/>
</td>
</tr>
</table>
</div>
作者: sayloveme_vip 发布时间: 2011-06-09
求高手告诉一下啊 。为什么 dlg = dojo.widget.byId( "DialogContent "); ----> > > 无法取到值 啊
作者: sayloveme_vip 发布时间: 2011-06-09