在JavaScript中没有多维数组的概念
但是可以模拟实现
1维
//1 不能确定数组length的情况下,先声明一个数组名,然后再逐个赋值。
var tArray=new Array();
tArray[0]='A';
tArray[1]='2';
//2 知道确切的length,创建数组
var tArray=new Array(10);
//3 创建数组的同时并赋值
var tArray=new Array('A','2','3','4','5','6','7','8','9','10','J','Q','K');
var tArray=['A','2','3','4','5','6','7','8','9','10','J','Q','K'];
// 以下的多维数组也类似
2维
方法1
var tArrar=new Array();
tArrar[0]=new Array();
tArrar[0][0]="aa";
tArrar[0][1]="bb";
tArrar[1]=new Array();
tArrar[1][0]="cc";
tArrar[1][1]="dd";
方法2
var aa=new Array(['1','2'],['3','4'],['5','6']);
方法3
javaStript声明二维数组:
var images=new Array(); //先声明一维
for(var i=0;i<10;i++){ //一维长度为10
images[i]=new Array(); ......
1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键
<table border oncontextmenu=return(false)> <td>no </table> 可用于Table
2. <body onselectstart="return false"> 取消选取、防止复制
3. onpaste="return false" 不准粘贴
4. oncopy="return false;" oncut="return false;" 防止复制
5. <link rel="Shortcut Icon" href="favicon.ico"> IE地址栏前换成自己的图标
6. <link rel="Bookmark" href="favicon.ico"> 可以在收藏夹中显示出你的图标
7. <input style="ime-mode:disabled"> 关闭输入法
8. 永远都会带着框架
<script language="JavaScript"> <!--
if (window == top)top.location.href = "frames.htm"; //frames.htm为框架网页
// --> </script>
9. 防止被人frame
<SCRIPT LANGUAGE=JAVASCRIPT> <!--
if (top.location != self.location)top.location=self.location;
// --> </SCRIPT>
10. 网页将不能被另存为
<noscript> <*** src="/*.html>"; </***> </noscript>
11. <input type=button ......
$wnd and $doc Calling native JavaScript with JSNI
$wnd 是什么?
GWT provides the $wnd and $doc variables to refer to the window and document objects
GWT使用通过Java Native method使用它,声明一个native方法,将含有JavaScript的方法体注释。编译器将注释块内的内容逐字输出,使之与编译产生的JavaScript整合到一起。
Java调用JavaScript方法:
JSNI方法定义需要使用native关键字,并且需要在参数列表之后,结尾的分号之前定义。JSNI方法的开始使用 /*-{ , 结尾使用}-*/,例如:
public static native void alert(String msg) /*-{
$wnd.alert(msg);
}-*/;
这是gwt Window 类中的源码--一个标准的jsni 方法, 我们可以看到,方法实现就是一行简单的javascript 代码. (这里没有用 alert 或者 window.alert 的原因是: gwt 代码运行在一个iframe中,如果直接用alert或者window.alert,引用的是iframe文档,而不是host page 文档). 经过这个方法包装,以后在gwt程序中使用 " Window.alert" 实际上就是调用了javascript 的 alert 方法,当然你也可以不用这个封装, 直接实用 $wnd.alert .
当上述方法在 ......
注意:readOnly中的O要大写
//页面初始化录入,判断指标说明是否为工资性支出。
function init() {
var mark = "<%=mark%>";
//如果指标说明为“工资性支出”,则工资支出那一项变为只读,且值为“指标可用金额”;其他录入框都不可录入。
if(mark!="" && mark=="工资性支出") {
document.getElementById("money0").readOnly = "true";
document.getElementById("money1").readOnly = "true";
document.getElementById("money3").readOnly = "true";
document.getElementById("forwhat0").readOnly = "true";
document.getElementById("forwhat1").readOnly = "true";
document.getElementById("forwhat3").readOnly = "true";
document.getElementById('money2').value = <%=budgetMoney[2]%>;
document.getElementById('money2').readOnly ......
Although the days of long and tedious code branches to target specific browsers in JavaScript are over, once in a while it's still necessary to do some simple code branching and object detection to ensure that a certain piece of code is working properly on a user's machine.
In this article, I'll outine 7 areas where Internet Explorer and Firefox differ in JavaScript syntax. In this article, I'll outine 7 areas where Internet Explorer and Firefox differ in JavaScript syntax.
1. The CSS “float” property 1. The CSS “float” property
The basic syntax for accessing a specific css property for any given object is object.style.property , using camel casing to replace a hyphenated property. For example, to access the background-color property of a The basic syntax for accessing a specific css property for any given object is object.style.property , using camel casing to replace a hyphenated property. For example ......
<HTML>
<HEAD>
<title>WEB页面导出为EXCEL文档的方法
</title>
</HEAD>
<body>
<BR>
<table id = "PrintA" width="100%" border="1" cellspacing="0" cellpadding="0" bgcolor = "#61FF13">
<TR style="text-align : center;" mce_style="text-align : center;">
<TD>单元格A</TD>
<TD>单元格A</TD>
<TD>单元格A</TD>
<TD>单元格A</TD>
</TR>
<TR>
<TD colSpan=4 style="text-align : center;" mce_style="text-align : center;"><font color="BLUE" face="Verdana">单元格合并行A</FONT></TD>
</TR>
</TABLE>
<BR>
<table id = "PrintB" width="100%" border="1" cellspacing="0" cellpadding="0">
<TR style="text-align : center;" mce_style="text-align : center;">
<TD>单元格B</TD>
<TD>单元格B</TD>
<TD>单元格B</TD>
<TD>单元格B</TD>
</TR>
<TR>
<TD colSpan=4 sty ......
<HTML>
<HEAD>
<title>WEB页面导出为EXCEL文档的方法
</title>
</HEAD>
<body>
<BR>
<table id = "PrintA" width="100%" border="1" cellspacing="0" cellpadding="0" bgcolor = "#61FF13">
<TR style="text-align : center;" mce_style="text-align : center;">
<TD>单元格A</TD>
<TD>单元格A</TD>
<TD>单元格A</TD>
<TD>单元格A</TD>
</TR>
<TR>
<TD colSpan=4 style="text-align : center;" mce_style="text-align : center;"><font color="BLUE" face="Verdana">单元格合并行A</FONT></TD>
</TR>
</TABLE>
<BR>
<table id = "PrintB" width="100%" border="1" cellspacing="0" cellpadding="0">
<TR style="text-align : center;" mce_style="text-align : center;">
<TD>单元格B</TD>
<TD>单元格B</TD>
<TD>单元格B</TD>
<TD>单元格B</TD>
</TR>
<TR>
<TD colSpan=4 sty ......