易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 : javascript

javascript写类方式之四

通过前面几篇得知javascript写类无非基于构造函数
和原型
。既然这样,我们写个工具函数来写类。
/**
* $class 写类工具函数之一
* @param {Object} constructor
* @param {Object} prototype
*/
function $class(constructor,prototype) {
var c = constructor || function(){};
var p = prototype || {};
c.prototype = p;
return c;
}

嗯。工具类写好了,来组装下:用构造函数来生成类实例的属性(字段),原型对象用来生成类实例的方法。
//构造函数
function Person(name) {
this.name = name;
}
//原型对象
var proto = {
getName : function(){return this.name},
setName : function(name){this.name = name;}
}
//组装
var Man = $class(Person,proto);
var Woman = $class(Person,proto);

ok,这时候已经得到了两个类Man,Woman。并且是同一个类型的。测试如下:
console.log(Man == Woman);//true
console.log(Man.prototype == Woman.prototype);//true

创建对象看看,
var man = new Man("Andy");
var woman = new Woman("Lily");
console.log(man instanceof Man);//true
console. ......

JavaScript 中文乱码解决方法

发送中文字符请求时,如果使用get方式,运行正常;而使用post方法则会出现乱码。这是由于异步对象XMLHttpRequest在处理返回的
responseText的时候,是按UTF-8编码进行解码的。如果你原来的网页编码是gb2312的话,当然会发生编码的冲突了;如果你原来的网页编
码是utf-8,那么就不会出现中文乱码的问题了。
出现了中文乱码该怎么办呢?通常的解决办法是用escape()对发送的数据进行编
码,然后在返回的responseText上再用unescape()进行解码。然而在JavaScript编程中通常不推荐使用escape()和
unescape(),而推荐使用encodeURI()和decodeURI()。 ......

VC++访问javascript的系列文章

有些网友经常询问:在VC++中如何访问javascript中的对象、函数、变量等元素?
这里把以前发表的一系列文章集中在一起,方便查阅。
vc++访问javascript(1)--window在脚本引擎中的作用 
http://blog.csdn.net/pimshell/archive/2008/08/02/2758863.aspx
vc++访问javascript(2)--IDispatchEx是动态脚本语言的基础 
http://blog.csdn.net/pimshell/archive/2008/08/04/2768182.aspx
vc++访问javascript(3)--遍历javascript中的数组
http://blog.csdn.net/pimshell/archive/2008/08/04/2768206.aspx
vc++访问javascript(4)--原来函数也是对象
http://blog.csdn.net/pimshell/archive/2008/08/05/2772413.aspx
vc++访问javascript(5)--绑定网页元素的事件
http://blog.csdn.net/pimshell/archive/2008/08/05/2773717.aspx
vb般的VC++开发(1)--引言
http://blog.csdn.net/pimshell/archive/2008/07/23/2699046.aspx
vb般的VC++开发(2)--COM异常与safecall
http://blog.csdn.net/pimshell/archive/2008/07/24/2704344.aspx
vb般的VC++开发(3)--#import
http://blog.csdn.net/pimshell/archive/2008/07/24/2705663.aspx
vb般的VC++开发(4)--调用IDispatc ......

VC++访问javascript的系列文章

有些网友经常询问:在VC++中如何访问javascript中的对象、函数、变量等元素?
这里把以前发表的一系列文章集中在一起,方便查阅。
vc++访问javascript(1)--window在脚本引擎中的作用 
http://blog.csdn.net/pimshell/archive/2008/08/02/2758863.aspx
vc++访问javascript(2)--IDispatchEx是动态脚本语言的基础 
http://blog.csdn.net/pimshell/archive/2008/08/04/2768182.aspx
vc++访问javascript(3)--遍历javascript中的数组
http://blog.csdn.net/pimshell/archive/2008/08/04/2768206.aspx
vc++访问javascript(4)--原来函数也是对象
http://blog.csdn.net/pimshell/archive/2008/08/05/2772413.aspx
vc++访问javascript(5)--绑定网页元素的事件
http://blog.csdn.net/pimshell/archive/2008/08/05/2773717.aspx
vb般的VC++开发(1)--引言
http://blog.csdn.net/pimshell/archive/2008/07/23/2699046.aspx
vb般的VC++开发(2)--COM异常与safecall
http://blog.csdn.net/pimshell/archive/2008/07/24/2704344.aspx
vb般的VC++开发(3)--#import
http://blog.csdn.net/pimshell/archive/2008/07/24/2705663.aspx
vb般的VC++开发(4)--调用IDispatc ......

VB.NET/C# and JavaScript communication

Introduction
This article is about passing data between VB.NET/C# WinForms and JavaScript.
Before reading further, let me warn you that this article is not about ASP.NET. Concepts covered in the article are applied to Desktop applications.
Background
I was working on a project which required data transfer between my VB.NET WinForms application and the JavaScript (inside an HTML page). Along the way, I hit certain problems, and trying to resolve them cost plenty of time on the web (on Google mostly), so I thought of this article as a platform for developers looking to sort out similar issues. There isn't much detail on this topic on the web apart from a couple of Hello World examples from Microsoft on MSDN.
Starting point
OK, without any further talk, I will dig in to the subject.
Hello World
To start off, we'll start with a very simple example; all this will do is call a JavaScript function from VB.NET to display an alert with message 'Hello world'. Similarly, from the HTML pag ......

VB.NET/C# and JavaScript communication

Introduction
This article is about passing data between VB.NET/C# WinForms and JavaScript.
Before reading further, let me warn you that this article is not about ASP.NET. Concepts covered in the article are applied to Desktop applications.
Background
I was working on a project which required data transfer between my VB.NET WinForms application and the JavaScript (inside an HTML page). Along the way, I hit certain problems, and trying to resolve them cost plenty of time on the web (on Google mostly), so I thought of this article as a platform for developers looking to sort out similar issues. There isn't much detail on this topic on the web apart from a couple of Hello World examples from Microsoft on MSDN.
Starting point
OK, without any further talk, I will dig in to the subject.
Hello World
To start off, we'll start with a very simple example; all this will do is call a JavaScript function from VB.NET to display an alert with message 'Hello world'. Similarly, from the HTML pag ......

VB.NET/C# and JavaScript communication

Introduction
This article is about passing data between VB.NET/C# WinForms and JavaScript.
Before reading further, let me warn you that this article is not about ASP.NET. Concepts covered in the article are applied to Desktop applications.
Background
I was working on a project which required data transfer between my VB.NET WinForms application and the JavaScript (inside an HTML page). Along the way, I hit certain problems, and trying to resolve them cost plenty of time on the web (on Google mostly), so I thought of this article as a platform for developers looking to sort out similar issues. There isn't much detail on this topic on the web apart from a couple of Hello World examples from Microsoft on MSDN.
Starting point
OK, without any further talk, I will dig in to the subject.
Hello World
To start off, we'll start with a very simple example; all this will do is call a JavaScript function from VB.NET to display an alert with message 'Hello world'. Similarly, from the HTML pag ......

通过javascript获得url参数

页面提交数据一般有两种方法:get,post。post就是所谓的form提交,使用视图;get是通过url提交。
Get方法一般用后台代码(如asp,asp.net)获得参数,代码很简单:Request.QueryString["id"];即可获取。 
有些时候需要直接在前台获取url参数,要用到javascript,js没有直接获取url参数的方法,那么,我们如何通过js获取url参数呢?
阅读 编辑 运行 复制  保存
<!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>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<script type="text/javascript">
function GetUrlParms()
{
var args=new Object();
var query=location.search.substring(1);//获取查询串
var pairs=query.split("&");//在逗号处断开
......

公历转换农历的算法(JavaScript)

很经典的一个算法,学习…ing… :
<!--  中国农历开始  -->
<SCRIPT language=JavaScript>
<!--
var lunarInfo=new Array(
0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,
0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977,
0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970,
0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950,
0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557,
0x06ca0,0x0b550,0x15355,0x04da0,0x0a5d0,0x14573,0x052d0,0x0a9a8,0x0e950,0x06aa0,
0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,
0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b5a0,0x195a6,
0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570,
0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0x0ab60,0x096d5,0x ......
总记录数:2244; 总页数:374; 每页6 条; 首页 上一页 [35] [36] [37] [38] 39 [40] [41] [42] [43] [44]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号