Form Control JavaScript DHTML



DynAPI Examples - HTML File


dynapi.library.setPath('./dynapisrc/');
dynapi.library.include('dynapi.api');
dynapi.library.include('TemplateManager');
dynapi.library.include('HTMLButton');
dynapi.library.include('HTMLFile');


var t  = 'This is the Template:
{@file}{@btnfile}

{@btnsend}
';
var tp = new Template(t,100,100,350,200,'#EEEEEE');
// it seems that only IE supports the hidden mode
tp.addChild(new HTMLFile(null,((dynapi.ua.ie)? true:false),20),'file');
tp.addChild(new HTMLButton(null,'Upload'),'btnsend');
tp.btnsend.onclick = function(e){
  alert('About to upload file "'+tp.file.getFileName()+'"');
};
if(dynapi.ua.ie) {
  tp.addChild(new HTMLButton(null,'Select a file'),'btnfile');
  tp.btnfile.addEventListener({
    onclick:function(e){ tp.file.browse() }
  });
};
dynapi.document.addChild(tp);






           
       
dynapi.zip( 791 k)