日期:2014-05-17 浏览次数:20667 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <script type="text/javascript" src="jquery.js"></script> <script> var i=0; var tdata={head:[{name:'名词'},{name:'数量'}],data:[{name:'语文',count:12},{name:'数学',count:30}]}; function addNewrow(){ $("#tt").append("<tr id='tr_"+i+"'><td>"+i+"<input name='fdsa' type='text'></td><td><button onclick='removeThis("+i+");'>删除</button></td></tr>"); i++; } function removeThis(ids){ $("#tr_"+ids).remove(); i--; } function reposition(){ $("#bottomdiv").css("margin-top",$(window).height()-$("#bottomdiv").height()-2); $("#bottomdiv").css("margin-left",$(window).width()-$("#bottomdiv").width()-2); $("#tt tbody").append("<tr>"); $.each(tdata.head,function(i,row){ $("#tt tbody").append("<th>"+row.name+"</th>"); }); $("#tt tbody").append("</tr>"); $.each(tdata.data,function(i,row){ $("#tt tbody").append("<tr><td>"+row.name+"</td><td>"+row.count+"</td></tr>"); }); } $(function (){ reposition(); }); var zoom=10; function maxZoom(){ zoom+=1; $("#zoomdiv").css("zoom",zoom/10); } function minZoom(){ alert(zoom+"mmmmmmmmm"); if(zoom<=1){ zoom=1; }else{ zoom-=1; } $("#zoomdiv").css("zoom",zoom/10); } var inobj=null; </script> </head> <body> <button onclick="addNewrow();">增加</button><button onclick="maxZoom();">放大</button><button onclick="minZoom();">缩小</button> <div id="zoomdiv"> <table id="tt"> <tbody> </tbody> </table> </div> </body> </html>