web技术概论第六周作业
来源:互联网 发布:java 报表工具 开源 编辑:程序博客网 时间:2024/06/13 11:22
Homework 0:
JavaScript Browser Sniffer is a browser identifier written in JavaScript (EcmaScript) and released under the LGPL license. It will tell which browser, version and operating system you (the visitor) are using. It also detects bots and the Flash plugin.
JavaScript browser sniffers are widely used because of the incompatibilities between browsers. Different browsers have different ways understanding the same code written by Javascript. As a result, different browsers will display the same page differently. Javascript browser sniffers detect what web browser a user is working with so as to ensure consistent display of content.
Homework 1: hiThere.html
So easy ~ 赵老师再也不用担心我的学习= =
Homework 2: function.html
- 简单的js运算操作,添加
result = result * 2;
即可 - 简单的js函数实现。代码段如下:
function StrCatenate(astr, bstr) { cstr = astr+" != "+bstr; return cstr; }
Homework 3: popups.html
- 根据弹出框的输入重定向页面,修改页面的location属性。代码见askName()函数。这里需要注意如果简单的将location改为“baidu.com”是无法跳转的,因为默认href为相对路径。输入前需要加上http等协议名。
当然,为了简化用户操作,我在函数中添加了自动的验证,即使输入不带协议头的路径,也可以正确跳转。 - the Lemon 后面添加 return 就可以了。
这里的status bar其实有点过期啊,我的电脑上只有chrome和firefox。结果网上查询的结果是
The new Firefox Status Bar only shows page loading activity and link previews. When neither of those are needed it simply disappears.The old Status Bar is dead, long live Status-4-Evar!
There’s no status bar in Chrome. The old toolstrip(on the bottom part of the browser) is eliminated in current versions of Chrome. Maybe you can try the switch but I guess it’s virtually useless since no current extensions now utilize that part of the UI.
郁闷死了==卡了半天,最后我在linux上安装了一个IE6,终于在左下角看到了status bar。真的是在linux上安装的,有图有真相!(statusbar.png)
Homework 4: objects.html
- 简单的全局数组变量操作var HolidayList = [ ];
- 2&3&4:简单的js类操作。代码如下:
function makeHoliday(dest, dur, cost) { hol = new Holiday(dest, dur, cost); HolidayList.push(hol); }
function outputObject(anObject) { for (f in anObject) { document.write(f + " = " + anObject[f] + "<br />"); } }
Homework 5: wizardForm.html
检测年龄并且限制年龄的大小。检测数字主要使用js自带的正则表达式。检测大小用eval进行数字之间的比较。
checkSubmit()阻塞提交其实与其返回值有关。如果返回true,表单会继续提交,返回false则停止提交。这种特性正好可以用于上面的检测函数。通过检测则提交,否则不提交。详细可见checkSubmit()函数。
- 另外,同样添加了其他几个测试函数checkName,checkID,限制输入值的字符。
function checkAge(q) { var reg = /^\d+$/; if (!reg.test(q.Personal_Age.value)) { return false; } if(eval(q.Personal_Age.value)<=5 || eval(q.Personal_Age.value)>=150) { return false; } return true;}
- web技术概论第六周作业
- web技术概论第二周作业
- web技术概论第三周作业
- web技术概论第五周作业
- 算法概论第六周作业
- 算法概论 第六周作业
- web技术概论第一周作业
- web技术概论第四周作业
- coursera 中计算概论的第六周 B-05作业
- 《算法概论》第六周作业——利用哈夫曼编码英文字母表
- 算法概论第二周作业
- 算法概论第三周作业
- 第三周作业 算法概论
- 算法概论 第五周作业
- 算法概论第五周作业
- 算法概论 第七周作业
- 算法概论第七周作业
- 菜鸟之路【计算导论与C基础】练习2:计算概论第六周 B-05作业
- 文章标题
- Android min, max, targetSDK详解
- java--三目运算符 类型自动提升
- 数据结构、算法与应用 (C++描述) 第二版 1.10
- Could not load the following font :pdfFontName : STSong-Light问题
- web技术概论第六周作业
- NodeJs开发微信公众号
- js实现html的placeholder属性效果
- 【Tomcat】eclipse如何安装tomcat插件
- 警报:XcodeGhost已扩散至第三方框架
- NSString+NSMutableString+NSValue+NSAraay用法汇总
- 关于C语言的fprintf与fwrite使用区别
- jpush 推送
- Android系统移植与调试之------->如何修改Android系统默认显示【开发者选项】并默认打开【USB调试】和【未知来源】开关