文章分类 - javascript
人民币大写金额转换
摘要:function AmountInWords(dValue, maxDec) { // 验证输入金额数值或数值字符串: dValue = dValue.toString().replace(/,/g, ""); dValue = dValue.replace(/^0+/, ""); // 金额数值转字符、移除逗号、移除前导零 if (dValue == "") { return "零元整"; } // (错误:金额为空!) else if (isNaN(dValue)) { return '<asp:
阅读全文
根据游客的ip信息获得地理信息,定位当地地图
摘要:<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><script language="javascript" type="text/javascript" src="http://int.dpool.sina.com.cn/iplookup/iplookup.ph
阅读全文
JS获取IP 及地区等信息
摘要:腾讯的ip开放接口(gbk)<script language="javascript" type="text/javascript" src="http://fw.qq.com/ipaddress"></script>2<script>document.write("你的IP是:"+IPData[0]+",来自:"+IPData[2]);</script>这个接口返回的是json格式的数据(utf8)<script language=&quo
阅读全文
深入理解JavaScript作用域和作用域链
摘要:作用域是JavaScript最重要的概念之一,想要学好JavaScript就需要理解JavaScript作用域和作用域链的工作原理。今天这篇文章对JavaScript作用域和作用域链作简单的介绍,希望能帮助大家更好的学习JavaScript。JavaScript作用域任何程序设计语言都有作用域的概念,简单的说,作用域就是变量与函数的可访问范围,即作用域控制着变量与函数的可见性和生命周期。在JavaScript中,变量的作用域有全局作用域和局部作用域两种。1. 全局作用域(Global Scope)在代码中任何地方都能访问到的对象拥有全局作用域,一般来说一下几种情形拥有全局作用域:(1)最外层.
阅读全文
动态增加select 选项
摘要:<!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 htt...
阅读全文
[翻译]javascript学习笔记 (六)-ajax相关
摘要:ajax相关 ajax大多数是通过服务器端语言来获取所需的数据,javascript发出请求,服务器将查询数据库然后返回数据。数据可以通过几种形式返回。如果他是结构化的,你可以用xml或json格式。如果他是非常简单的数据,例如文本,一般人们直接返回这种数据。 创建一个xmlhttp对象 Code highlighting produced by Actipro CodeHighlight...
阅读全文
[翻译]javascript学习笔记 (四)-面向对象的实现
摘要:javascript中面向对象的实现 javascript中的函数可以充当类的角色,我们用函数的prototype完成类的功能。 首先了解javascript中的对象是如何工作的,对象允许你定义一个变量然后可以在变量上设置任意多的属性 让我们看下一个简单的例子 Code highlighting produced by Actipro CodeHighlighter (freeware) h...
阅读全文
[翻译]javascript学习笔记 (五) -继承和Closures
摘要:javascript中的继承和Closures 实现继承的两种方法 使用"call"函数,call允许我们在一个上下文环境中调用另外一个函数。我们在cat和dog类中调用animal类。 Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->fu...
阅读全文
[翻译]javascript学习笔记 (三)-window对象
摘要:window全局对象的常用属性 属性 描述 window.location returns the current URL for the window. window.opener ...
阅读全文
[翻译]javascript学习笔记 (二)-DOM
摘要:HTML DOM 图片翻转效果 Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> 动态的添加移除页面上的联系人 Code highlighting produced by Actipro CodeHighlighter (fre...
阅读全文
[翻译]javascript学习笔记 (一)-函数基础
摘要:正则表达式验证表单 Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->function validateForm(){ var email = document.forms.tutform.elements.email.value; ...
阅读全文
javascript cookies 存、取、删除实例收藏
摘要:一个非常实用的javascript读写Cookie函数 一个非常实用的javascript读写Cookie函数 function GetCookieVal(offset) //获得Cookie解码后的值 { var endstr = documents.cookie.indexOf (";", offset); if (endstr == -1) endstr =...
阅读全文
javascript小技巧
摘要:事件源对象 event.srcElement.tagName event.srcElement.type 捕获释放 event.srcElement.setCapture(); event.srcElement.releaseCapture(); 事件按键 event.keyCode event.shif...
阅读全文
ctrl+enter发送消息
摘要:1、使用javascript,ctrl+enter发送消息 function document.onkeydown() { var e=event.srcElement; if(event.keyCode==13 && event.ctrlKey==1) { document.getElementById("LinkButton1").click(); return false;...
阅读全文
JS获取浏览器窗口大小 获取屏幕,浏览器,网页高度宽度
摘要:JS获取浏览器窗口大小 获取屏幕,浏览器,网页高度宽度 2008年06月06日 星期五 10:36 网页可见区域宽:document.body.clientWidth 网页可见区域高:document.body.clientHeight 网页可见区域宽:docum...
阅读全文
JS创建FLASH,访讯雷截屏
摘要:function createFlashMove(obj,sName,src,width,height,wmode,fullscreen){ var swf=document.createElement("object"); var param=document.createElement("param"); param.setAttribute("name","movie...
阅读全文
浙公网安备 33010602011771号