<!DOCTYPE html> <html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px"> <head> <title></title> <meta charset="utf-8"> <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> <link rel="stylesheet" href="css/ui-base.css"> <link rel="stylesheet" href="css/ui-box.css"> <link rel="stylesheet" href="css/ui-color.css"> <link rel="stylesheet" href="css/ui-res.css"> <script src="js/zy_control.js"></script> <script src="js/zy_click.js"></script> <script></script> </head> <body class="um-vp c-wh" ontouchstart> <div class="tit">文件管理</div> <div class="conbor"> <div class="consj"> <span>用户名和密码</span> <span>输入用户名和密码:</span> <input class="textbox" id="usename" type="text" value="test"> <input class="textbox" id="pwd1" type="text" value="111111"> <input class="btn" type="button" value="创建" onclick="createFile();"> <input class="btn" type="button" value="写入" onclick="writeFile();"> <input class="btn" type="button" value="读出" onclick="readFile();"> <input class="btn" type="button" value="返回" onclick="uexWindow.back();"> </div> </div> </body> <script> var path="wgt://data/pass3.txt"; //如果这里的路径直接在创建或者读取的时候写入将会在读取文件的时候显示为空值 //创建写入文件 function createFile(){ uexFileMgr.createFile(‘1‘,path); uexFileMgr.closeFile(‘1‘); } //写入文件 function writeFile(){ var usename=document.getElementById("usename").value; var pwd1=document.getElementById("pwd1").value; var content = usename+","+pwd1; uexFileMgr.openFile(‘1‘,path,‘1‘); uexFileMgr.writeFile(‘1‘,‘1‘,content); uexFileMgr.closeFile(‘1‘); } //读取文件 function readFile(){ uexFileMgr.openFile(‘1‘,path,‘1‘); uexFileMgr.readFile(‘1‘,‘-1‘); uexFileMgr.closeFile(‘1‘); } zy_init(); var cText = 0; var cJson = 1; var cInt = 2; window.uexOnload = function(){ uexFileMgr.cbReadFile = function(opCode,dataType,data){ switch(dataType){ case cText: var array=data.split(","); document.getElementById("usename").value=array[0];//用户名 document.getElementById("pwd1").value=array[1];//密码 break; case cJson: alert("uex.cJson"); break; case cInt: alert("uex.cInt"); break; default: alert("error"); } } } </script> </html>