热门关键字:  ubuntu  分区  linux系统进程  Fedora  函数
当前位置 :| 主页>Linux教程>编程开发>Ruby>

在Ajax设计程序时动态加载文本域和下拉框

来源: 作者: 时间:2007-11-20 Tag: 点击:
在Ajax设计程序时动态加载文本域和下拉框:
其方法如下:
function createCellText(){
   var text=document.createElement('input');
       text.setAttribute('name','txt');
       text.setAttribute('type','text');
       text.setAttribute('id','txt');
       text.setAttribute('value','txt');
       text.setAttribute('size','3');
   var cell=document.createElement('td');
       cell.setAttribute('align','center');
       cell.appendChild(text);
   return cell;       
}
function createCellSelect(){
   var erp=new Array(2);
 
   for(var i=0;i<erp.length;i++){
       erp[i]="mm"+i;     
   }
   var select=document.createElement('select');
       select.setAttribute('id','mrp');
       select.setAttribute('size','1');
 
      for(var i=0;i<erp.length;i++){
       window.alert("erp["+i+"]="+erp[i]);
   var option=null;
       option=document.createElement('option');
       option.appendChild(document.createTextNode(erp[i]));
       option.setAttribute('value','');
        select.appendChild(option);
       }      
     
   var cell=document.createElement('td');   
       cell.setAttribute('align','center');
       cell.appendChild(select);  
   return cell;    
}
 
 

上一篇:Ruby On Rails入门经典 第三章 类和对象
下一篇:没有了
最新评论共有 4 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册
栏目列表