随笔分类 -  javascript

摘要:The reason you see [object Object] is because msg is of type object and you pass it into .html which will convert it to a string. And thus the html is filled with the string representation of object which in this case is "[object Object]" 具体的解决方法是 var x=$("#xxx").hide(); 阅读全文
posted @ 2012-05-07 08:26 杨伟明 阅读(2168) 评论(0) 推荐(0)
摘要:直接上代码:<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title> <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script> <style type="text/css"> #myMessageDiv { position:a 阅读全文
posted @ 2012-02-08 09:31 杨伟明 阅读(1441) 评论(0) 推荐(0)
摘要:我的程序用javascript与Html中的table结合,实现的简单的贪食蛇游戏,游戏的主要特点,可调整蛇移动速度,可调整蛇移动范围,碰壁、咬到身体则“Game Over!”并且有关卡加速功能。游戏并不完善,只是实现了主要的功用,有设计不合理的地方,欢迎您感大家提意见! 实现方法:由javascript语言中的setInterval方法驱动整个游戏程序,设置“nowDirection”即蛇的当前移动方向为全局变量,由setInterval方法定时获取蛇的移动方向,由document.onkeydown()捕捉当前按键(上、下、左、右)以修改nowDirection,这样就可以用方向按键控.. 阅读全文
posted @ 2011-10-18 13:48 杨伟明 阅读(1907) 评论(10) 推荐(1)