[移动云计算开发 02] 第一个在手机内置浏览器跑的程序


首先要安装nginx服务 ,具体的流程,可参考 http://www.cnblogs.com/daomul/p/3315703.html

设置完需要知道本地IP地址,http://192.1**.*.*/view.html

1
<!DOCTYPE html> 2 <html> 3 <head> 4 <meta name="viewport" content="user-scalable=no,initial-scale=1.0,maximum-scale=1.0" /> 5 6 <style> 7 body { margin: 0px; } 8 #tapper { 9 margin: 10px; 10 width: 300px; 11 height: 300px; 12 background-color: #f00; 13 } 14 </style> 15 16 <script> 17 function hex() {
//通过hex()函数可以随机生成一种颜色,通过点击切换
18 var hexchars = "0123456789abcedf"; 19 var hexval = Math.floor(16 * Math.random()); 20 return hexchars[hexval]; 21 } 22 window.onload = function() { 23 var tapper = document.getElementById("tapper") 24 tapper.onclick = function() { 25 tapper.style.backgroundColor = "#"+hex()+hex()+hex(); 26 } 27 } 28 </script> 29 </head> 30 <body> 31 <div id="tapper"></div> 32 </body> 33 </html>

 

posted @ 2013-09-13 17:21  daomul  阅读(199)  评论(0编辑  收藏  举报