??xml version="1.0" encoding="utf-8" standalone="yes"?>久久精品小视频,天天在线视频色,动漫黄在线观看http://www.aygfsteel.com/deepbluesea/Let's Go!zh-cnSun, 27 Jul 2025 16:54:42 GMTSun, 27 Jul 2025 16:54:42 GMT60好好学英?009-1-6http://www.aygfsteel.com/deepbluesea/archive/2009/01/06/250046.htmldeepblueseadeepblueseaTue, 06 Jan 2009 02:06:00 GMThttp://www.aygfsteel.com/deepbluesea/archive/2009/01/06/250046.htmlhttp://www.aygfsteel.com/deepbluesea/comments/250046.htmlhttp://www.aygfsteel.com/deepbluesea/archive/2009/01/06/250046.html#Feedback0http://www.aygfsteel.com/deepbluesea/comments/commentRss/250046.htmlhttp://www.aygfsteel.com/deepbluesea/services/trackbacks/250046.htmlIf you want to gain more, then will you be willing to lost something?

People often gain from losing, and lose from gain. Women changed men, men changed the world, these maybe truth. We seem to understand cherish after losing, the people who don’t understand cherish isn’t eligible for owning it, losing make people gain more then know how to cherish. Gain and losing, which one gains more and understand better?
If we get one thing, is it a must to lose another thing? Life is full of fickleness, there is gain, there must be losing, you should know to cherish when you are gaining, learn to be relieved when you are losing, most people are greedy, if you want to gain more, would you like to lose?


deepbluesea 2009-01-06 10:06 发表评论
]]>
好好学英?009-1-4http://www.aygfsteel.com/deepbluesea/archive/2009/01/04/249672.htmldeepblueseadeepblueseaSun, 04 Jan 2009 00:38:00 GMThttp://www.aygfsteel.com/deepbluesea/archive/2009/01/04/249672.htmlhttp://www.aygfsteel.com/deepbluesea/comments/249672.htmlhttp://www.aygfsteel.com/deepbluesea/archive/2009/01/04/249672.html#Feedback0http://www.aygfsteel.com/deepbluesea/comments/commentRss/249672.htmlhttp://www.aygfsteel.com/deepbluesea/services/trackbacks/249672.html


deepbluesea 2009-01-04 08:38 发表评论
]]>
js 向action 传长参数http://www.aygfsteel.com/deepbluesea/archive/2008/12/16/246641.htmldeepblueseadeepblueseaTue, 16 Dec 2008 07:49:00 GMThttp://www.aygfsteel.com/deepbluesea/archive/2008/12/16/246641.htmlhttp://www.aygfsteel.com/deepbluesea/comments/246641.htmlhttp://www.aygfsteel.com/deepbluesea/archive/2008/12/16/246641.html#Feedback0http://www.aygfsteel.com/deepbluesea/comments/commentRss/246641.htmlhttp://www.aygfsteel.com/deepbluesea/services/trackbacks/246641.html 

function openWindowWithPost(url,name,keys,values)
{
var newWindow = window.open(url, name); 
if (!newWindow) return false;
var html = "";
html 
+= "<html><head></head><body><form id='formid' method='post' action='" + url + "'>";
if (keys && values && (keys.length == values.length))
for (var i=0; i < keys.length; i++)
{
//alert(keys[i]+"="+values[i]);
html += "<input type='hidden' name='" + keys[i] + "' value=\"" + values[i] + "\"/>";
}

html 
+= "</form><script type='text/javascript'>document.getElementById(\"formid\").submit()</script></body></html>";
newWindow.document.write(html);
return newWindow;
}


deepbluesea 2008-12-16 15:49 发表评论
]]>
采用dwr ajax和struts开发文件上传进度条http://www.aygfsteel.com/deepbluesea/archive/2008/10/24/236389.htmldeepblueseadeepblueseaFri, 24 Oct 2008 06:00:00 GMThttp://www.aygfsteel.com/deepbluesea/archive/2008/10/24/236389.htmlhttp://www.aygfsteel.com/deepbluesea/comments/236389.htmlhttp://www.aygfsteel.com/deepbluesea/archive/2008/10/24/236389.html#Feedback2http://www.aygfsteel.com/deepbluesea/comments/commentRss/236389.htmlhttp://www.aygfsteel.com/deepbluesea/services/trackbacks/236389.html~写监听器以及相关的c?/font>

不用自己写了Q源码可以从

http://www.telio.be/blog/2006/01/06/ajax-upload-progress-monitor-for-commons-fileupload-example里面下蝲Q?/font>

下蝲地址

http://www.telio.be/blog/wp-content/uploads/2006/01/ajax-upload-1.0.war

下蝲完之后,你需要解包,在命令行中:

jar xvf ajax-upload-1.0.war
源码在\WEB-INF\src下面

要用到的文件有resources文g夹下Q\WEB-INF\下面的dwr.xml和lib下面的jar文g

上传面

在上面解开的包里面有index.jspq个是上传页面,upload.jsp负责上传Qresources包里面包含了dwr与服务器通讯的javascript脚本Q你需要把index.jsp的form中的action换成你的struts action卛_Q然后把form中的file名改成你actionform中的file属性名Q把面中剩余的fileL

index.jsp上传面CZ代码Q?/font>

<%@ page contentType="text/html; charset=gb2312" language="java"

import="java.util.*" errorPage=""%>

<%

String path=request.getContextPath();

%>

<html locale="true">

<head>

<SCRIPT language=javascript>

 

function check_file() {

 

var strFileName=document.forms(0).file;

 

if (strFileName.value==""){

alert("请选择要上传的文g");

return false;

}

startProgress();

}

 

function loadmessage(){

 

<%

if (request.getAttribute("message") != null) {

%>

window.alert("<%=request.getAttribute("message")%>");

window.returnValue="yes";

 

<%}%>

 

}

 

</SCRIPT>

<title>上传</title>

<script src='<%=path%>/resources/js/upload.js'> </script>

 

<script src='<%=path%>/dwr/interface/UploadMonitor.js'> </script>

 

<script src='<%=path%>/dwr/engine.js'> </script>

<script src='<%=path%>/dwr/util.js'> </script>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="loadmessage()">

<form name="form" method="post" action="<%=path%>/upload.do?method=upload" enctype="multipart/form-data" onSubmit="return check_file()">

<table width="60%" border="0" cellspacing="1">

<tr background-color=" #E7F5FE">

 

<td width="30%" align="right">从文件导入:</td>

<td width="51%"><input type="file" name="file" class="input"></td>

<td width="27%"><input type="submit" name="files" class="button_4"

 

style="border-style:None;width:71px;" value="定" id="uploadbutton">

</td>

</tr>

 

<tr align="left" background-color=" #E7F5FE">

 

 

<td colspan="3">

<div id="progressBar" style="display: none;">

 

<div id="theMeter">

<div id="progressBarText"></div>

<div id="progressBarBox">

<div id="progressBarBoxContent"></div>

 

</div>

 

</div>

</div>

</td>

 

</tr>

 

</table>

 

</form>

</body>

 

</html>

q且要修改一下\resources\js中的upload.js文gQ?/font>

function refreshProgress()

 

{

UploadMonitor.getUploadInfo(updateProgress); 

}

function updateProgress(uploadInfo)

 

{

if (uploadInfo.inProgress)

{

document.getElementById('uploadbutton').disabled = true;

document.getElementById('file').disabled = true;

var fileIndex = uploadInfo.fileIndex;

 

var progressPercent = Math.ceil((uploadInfo.bytesRead / uploadInfo.totalSize) * 100);

document.getElementById('progressBarText').innerHTML = '文gdq度: ' progressPercent '%';

document.getElementById('progressBarBoxContent').style.width = parseInt(progressPercent * 3.5) 'px';

window.setTimeout('refreshProgress()', 1000);

}

else

{

document.getElementById('uploadbutton').disabled = false;

document.getElementById('file').disabled = false;

}

return true;

}

function startProgress()

{

 

document.getElementById('progressBar').style.display = 'block';

document.getElementById('progressBarText').innerHTML = '文gdq度: 0%';

document.getElementById('uploadbutton').disabled = true;

// wait a little while to make sure the upload has started ..

window.setTimeout("refreshProgress()", 1000);

return true;

 

}

配置dwr.xml

 

攑֜/WEB-INF/下面

 

 

<dwr>

 

<allow>

<create creator="new" javascript="UploadMonitor">

<param name="class" value="be.telio.mediastore.ui.upload.UploadMonitor"/>

</create>

<convert converter="bean" match="be.telio.mediastore.ui.upload.UploadInfo"/>

</allow>

 

</dwr>

web.xml中配|?/strong>dwrQ省略springQstruts{的配置

 

<servlet>

<servlet-name>dwr-invoker</servlet-name>

 

<display-name>DWR Servlet</display-name>

 

 

<servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>

 

 

<init-param>

<param-name>debug</param-name>

 

<param-value>false</param-value>

</init-param>

 

<init-param>

<param-name>logLevel</param-name>

<param-value>WARN</param-value>

</init-param>

</servlet>

 

<servlet-mapping>

 

<servlet-name>dwr-invoker</servlet-name> 

<url-pattern>/dwr/*</url-pattern> 

</servlet-mapping>

~写struts?/strong>MultipartRequestHandler QAjaxMultipartRequestHandler

实现 MultipartRequestHandler接口q在struts-config.xml的controller中替换默认的multipartClass

<controller>

<set-property property="multipartClass"

value="org.springside.components.ajaxupload.AjaxMultipartRequestHandler" />

 

 

</controller>

其实q个cAjaxMultipartRequestHandler~写很简单,把struts的src源码中的org.apache.struts.upload.CommonsMultipartRequestHandler.java修改一下就可以?strong>Q?/strong>

?strong>public void handleRequest(HttpServletRequest request)

 

throws ServletException {

 

Ҏ(gu)中把定义factory之前的那几行代码注释掉然后写?/font>

 

UploadListener listener = new UploadListener(request, 30);

 

FileItemFactory factory = new MonitoredDiskFileItemFactory(listener);

之后再注释掉

 

// upload.setSizeThreshold((int) getSizeThreshold(ac));

// upload.setRepositoryPath(getRepositoryPath(ac));

 

q个cd写完了

 

~写struts上传c?/strong>

q你原来编写的struts上传c?/font>
上传Ҏ(gu)代码D늤例:

 

/**

 

 

* 上传文g

 

*/

public ActionForward upload(ActionMapping mapping, ActionForm form,

 

HttpServletRequest request, HttpServletResponse response)

 

throws Exception {

String path = getServlet().getServletContext().getRealPath("/");

 

log.info(">>>>>>>>>>>>>>>path:" path);

 

if (form == null) {

return mapping.findForward("success");

}

 

FileUploadForm fuf = (FileUploadForm) form;

FormFile file = fuf.getFile();

try {

 

if (file == null) {

log.info(">>>>>>>>>>>>>>>file为空");

 

return mapping.findForward("success");

 

}

} catch (Exception e) {

e.printStackTrace();

 

}

String fname = file.getFileName();

 

int t = 0;

 

for (int i = 0; i < fname.length(); i ) {

 

if (fname.charAt(i) == '.') {

 

t = i;

} }

 

 

String filename = null;
if (t > 0) {

 

filename = fname.substring(0, t);

}

 

log.info(">>>>>>>>>>>>>>>文g名:" filename);

 

String filepath = path "dataimport/upfiles/" fname;

File f = new File(path "dataimport/upfiles/");

 

log.info(">>>>>>>>>>>>>>>文g生成路径Q? filepath);
if (!f.exists()) {

 

 

f.mkdirs();

} else {

log.info(">>>>>>>>>>>>>>>路径存在");

}

 

 

InputStream stream = file.getInputStream();

OutputStream os = new FileOutputStream(path "dataimport/upfiles/"

 

 

fname);

int readBytes = 0;

 

byte buffer[] = new byte[8192];

while ((readBytes = stream.read(buffer, 0, 8192)) != -1) {

 

os.write(buffer, 0, readBytes);

 

}

os.close();

 

stream.close();

 

file.destroy();

 

 

String message = "成功Q?;

 

request.setAttribute("message", message);

return mapping.findForward("success");

}



deepbluesea 2008-10-24 14:00 发表评论
]]>
dwr 学习W记1http://www.aygfsteel.com/deepbluesea/archive/2008/10/15/234547.htmldeepblueseadeepblueseaWed, 15 Oct 2008 15:18:00 GMThttp://www.aygfsteel.com/deepbluesea/archive/2008/10/15/234547.htmlhttp://www.aygfsteel.com/deepbluesea/comments/234547.htmlhttp://www.aygfsteel.com/deepbluesea/archive/2008/10/15/234547.html#Feedback0http://www.aygfsteel.com/deepbluesea/comments/commentRss/234547.htmlhttp://www.aygfsteel.com/deepbluesea/services/trackbacks/234547.html单例子:

HTML source:

<p>
Name:
<input type="text" id="demoName"/>
<input value="Send" type="button" onclick="update()"/>
<br/>
Reply: <span id="demoReply"></span>
</p>

Javascript source:

function update() {
var name = dwr.util.getValue("demoName");
Demo.sayHello(name, function(data) {
dwr.util.setValue("demoReply", data);
});
}

Java source:

package org.getahead.dwrdemo.simpletext;
public class Demo {
public String sayHello(String name) {
return "Hello, " + name;
}
}

dwr.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dwr PUBLIC
"-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN"
"http://getahead.org/dwr/dwr20.dtd">
<dwr>
<allow>
<create creator="new" javascript="Demo">
<param name="class" value="org.getahead.dwrdemo.simpletext.Demo"/>
</create>
</allow>
</dwr>
其他配置Q?/pre>
 1   web.xml: 

 <listener>
    <listener-class>org.directwebremoting.servlet.EfficientShutdownServletContextAttributeListener</listener-class>
  </listener>
  <listener>
    <listener-class>org.directwebremoting.servlet.EfficientShutdownServletContextListener</listener-class>
  </listener>
 
 
   <servlet>
    <servlet-name>dwr-invoker</servlet-name>

    <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>

    <!-- This should NEVER be present in live -->
    <init-param>
      <param-name>debug</param-name>
      <param-value>true</param-value>
    </init-param>

    <!-- Remove this unless you want to use active reverse ajax -->
    <init-param>
      <param-name>activeReverseAjaxEnabled</param-name>
      <param-value>true</param-value>
    </init-param>

    <!-- By default DWR creates application scope objects when they are first
    used. This creates them when the app-server is started -->
    <init-param>
      <param-name>initApplicationScopeCreatorsAtStartup</param-name>
      <param-value>true</param-value>
    </init-param>

    <!-- This enables full streaming mode. It's probably better to leave this
    out if you are running across the internet -->
    <init-param>
      <param-name>maxWaitAfterWrite</param-name>
      <param-value>-1</param-value>
    </init-param>

    <!--
    For more information on these parameters, see:
    - http://getahead.org/dwr/server/servlet
    - http://getahead.org/dwr/reverse-ajax/configuration
    -->

    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>dwr-invoker</servlet-name>
    <url-pattern>/dwr/*</url-pattern>
  </servlet-mapping>

2 js文g引入Q因为我面代码攑֜了index.jsp里面。所以引入js的代码如下:
  <script type='text/javascript' src='./tabs/tabs.js'> </script>
  <script type='text/javascript' src='./dwr/engine.js'> </script>
  <script type='text/javascript' src='./dwr/util.js'> </script>
  <script type='text/javascript' src='./dwr/interface/Demo.js'> </script>
  应该建立一个项目\径。在所有文仉使用l一的\径?/pre>


deepbluesea 2008-10-15 23:18 发表评论
]]>oracle sql 取星期?/title><link>http://www.aygfsteel.com/deepbluesea/archive/2008/10/07/232936.html</link><dc:creator>deepbluesea</dc:creator><author>deepbluesea</author><pubDate>Tue, 07 Oct 2008 07:40:00 GMT</pubDate><guid>http://www.aygfsteel.com/deepbluesea/archive/2008/10/07/232936.html</guid><wfw:comment>http://www.aygfsteel.com/deepbluesea/comments/232936.html</wfw:comment><comments>http://www.aygfsteel.com/deepbluesea/archive/2008/10/07/232936.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/deepbluesea/comments/commentRss/232936.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/deepbluesea/services/trackbacks/232936.html</trackback:ping><description><![CDATA[select to_char(sysdate-4,'D'),to_char(sysdate-4,'dy') from dual;<br /> <img src ="http://www.aygfsteel.com/deepbluesea/aggbug/232936.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/deepbluesea/" target="_blank">deepbluesea</a> 2008-10-07 15:40 <a href="http://www.aygfsteel.com/deepbluesea/archive/2008/10/07/232936.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java应用Q编写高UJavaScript应用代码 http://www.aygfsteel.com/deepbluesea/archive/2008/09/02/226286.htmldeepblueseadeepblueseaTue, 02 Sep 2008 02:35:00 GMThttp://www.aygfsteel.com/deepbluesea/archive/2008/09/02/226286.htmlhttp://www.aygfsteel.com/deepbluesea/comments/226286.htmlhttp://www.aygfsteel.com/deepbluesea/archive/2008/09/02/226286.html#Feedback0http://www.aygfsteel.com/deepbluesea/comments/commentRss/226286.htmlhttp://www.aygfsteel.com/deepbluesea/services/trackbacks/226286.html1、创建高U对?

使用构造函数来创徏对象

构造函数是一个函敎ͼ调用它来例示q初始化Ҏ(gu)cd的对象。可以?new 关键字来调用一个构造函数。下面给Z使用构造函数的新示例?

var myObject = new Object(); // 创徏没有属性的通用对象?

var myBirthday = new Date(1961, 5, 10); // 创徏一?Date 对象?

var myCar = new Car(); // 创徏一个用户定义的对象Qƈ初始化其属性?

通过构造函数将一个参C为特定的 this 关键字的g递给新创建的I对象。然后构造函数负责ؓ新对象执行适应的初始化Q创建属性ƈl出其初始|。完成后Q构造函数返回它所构造的对象的一个参数?

~写构造函?

可以使用 new q算W结合像 Object()、Date() ?Function() q样的预定义的构造函数来创徏对象q对其初始化。面向对象的~程其强有力的特征是定义自定义构造函C创徏脚本中用的自定义对象的能力。创Z自定义的构造函敎ͼq样可以创建具有已定义属性的对象。下面是自定义函数的CZQ注?this 关键字的使用Q?

function Circle (xPoint, yPoint, radius) {

this.x = xPoint; // 圆心?x 坐标?

this.y = yPoint; // 圆心?y 坐标?

this.r = radius; // 圆的半径?

}

调用 Circle 构造函数时Q给出圆心点的值和圆的半径Q所有这些元素是完全定义一个独特的圆对象所必需的)。结束时 Circle 对象包含三个属性。下面是如何例示 Circle 对象?

var aCircle = new Circle(5, 11, 99);

使用原型来创建对?

在编写构造函数时Q可以用原型对象(它本w是所有构造函数的一个属性)的属性来创徏l承属性和׃nҎ(gu)。原型属性和Ҏ(gu)按引用复制l类中的每个对象Q因此它们都h相同的倹{可以在一个对象中 更改原型属性的|新的值将覆盖默认|但仅在该实例中有效。属于这个类的其他对象不受此更改的媄响。下面给Z使用自定义构造函数的CZQCircleQ注?this 关键字的使用Q?

Circle.prototype.pi = Math.PI;

function ACirclesArea () {

return this.pi * this.r * this.r; // 计算圆面U的公式??r2?

}

Circle.prototype.area = ACirclesArea; // 计算圆面U的函数现在?Circle Prototype 对象的一个方法?

var a = ACircle.area(); // 此ؓ如何?Circle 对象上调用面U函数?

使用q个原则Q可以给预定义的构造函敎ͼ都具有原型对象)定义附加属性。例如,如果惌能够删除字符串的前后I格Q与 VBScript ?Trim 函数cMQ,可以给 String 原型对象创徏自己的方法?

// 增加一个名?trim 的函C?

// String 构造函数的原型对象的一个方法?

String.prototype.trim = function()

{

// 用正则表辑ּ前后空?

// 用空字符串替代?

return this.replace(/(^\s*)|(\s*$)/g, "");

}

// 有空格的字符?

var s = " leading and trailing spaces ";

// 昄 " leading and trailing spaces (35)"

window.alert(s + " (" + s.length + ")");

// 删除前后I格

s = s.trim();

// 昄"leading and trailing spaces (27)"

window.alert(s + " (" + s.length + ")");

2.递归

递归是一U重要的~程技术。该Ҏ(gu)用于让一个函C其内部调用其自n。一个示例就是计阶乘? 的阶乘被特别地定义ؓ 1?更大数的阶乘是通过计算 1 * 2 * ...来求得的Q每ơ增?1Q直臌到要计算光乘的那个数?

下面的段落是用文字定义的计算阶乘的一个函数?

“如果q个数小于零Q则拒绝接收。如果不是一个整敎ͼ则将其向下舍入ؓ盔R的整数。如果这个数?0Q则光乘ؓ 1。如果这个数大于 0Q则其与相邻较?yu)的数的阶乘怹?#8221;

要计Q何大?0 的数的阶乘,臛_需要计一个其他数的阶乘。用来实现这个功能的函数是已经位于其中的函敎ͼ该函数在执行当前的这个数之前Q必调用它本n来计相ȝ较小数的阶乘。这是一个递归CZ?

递归和P代(循环Q是密切相关?? 能用递归处理的算法也都可以采用P代,反之亦然。确定的法通常可以用几U方法实玎ͼ(zhn)只需选择最自然贴切的方法,或者?zhn)觉得用v来最L的一U即可?

昄Q这h可能会出现问题。可以很Ҏ(gu)地创Z个递归函数Q但该函C能得C个确定的l果Qƈ且不能达C个终炏V这L递归导致计机执行一?#8220;无限”循环。下面就是一个示例:在计阶乘的文字描述中遗漏了W一条规则(对负数的处理Q?Qƈ试图计算M负数的阶乘。这导致失败,因ؓ按顺序计?-24 的阶乘时Q首先不得不计算 -25 的阶乘;然而这样又不得不计?-26 的阶乘;如此l箋。很明显Q这hq也不会到达一个终止点?

因此在设计递归函数时应特别仔细。如果怀疑其中存在着无限递归的可能,则可以让该函数记录它调用自n的次数。如果该函数调用自n的次数太多,即(zhn)已军_了它应调用多次Q就自动退出?

下面仍然是阶乘函敎ͼq次是用 JScript 代码~写的?

// 计算阶乘的函数。如果传递了

// 无效的数|例如于ӞQ?

// 返?-1Q表明发生了错误。若数值有效,

// 把数D{换ؓ最相近的整敎ͼq?

// q回阶乘?

function factorial(aNumber) {

aNumber = Math.floor(aNumber); // 如果q个C是一个整敎ͼ则向下舍入?

if (aNumber < 0) { // 如果q个数小?0Q拒l接收?

return -1;

}

if (aNumber == 0) { // 如果?0Q则光乘ؓ 1?

return 1;

}

else return (aNumber * factorial(aNumber - 1)); // 否则Q递归直至完成?

}

3.变量范围

JScript 有两U变量范_全局和局部。如果在M函数定义之外声明了一个变量,则该变量为全局变量Q且该变量的值在整个持箋范围内都可以讉K和修攏V如果在函数定义内声明了一个变量,则该变量为局部变量。每ơ执行该函数旉会创建和破坏该变量;且它不能被该函数外的M事物讉K?

?C++ q样的语a也有“块范?#8221;。在q里QQ何一?#8220;{}”都定义新的范围。JScript 不支持块范围?

一个局部变量的名称可以与某个全局变量的名U相同,但这是完全不同和独立的两个变量。因此,更改一个变量的g会媄响另一个变量的倹{在声明局部变量的函数内,只有该局部变量有意义?

var aCentaur = "a horse with rider,"; // aCentaur 的全局定义?

// JScript 代码Qؓzv见有省略?

function antiquities() // 在这个函C声明了一个局?aCentaur 变量?

{

// JScript 代码Qؓzv见有省略?

var aCentaur = "A centaur is probably a mounted Scythian warrior";

// JScript 代码Qؓzv见有省略?

aCentaur += ", misreported; that is, "; // d到局部变量?

// JScript 代码Qؓzv见有省略?

} // 函数l束?

var nothinginparticular = antiquities();

aCentaur += " as seen from a distance by a naive innocent.";

/*

在函数内Q该变量的gؓ "A centaur is probably a mounted Scythian warrior,

misreported; that is, "Q在函数外,该变量的gؓq句话的其余部分Q?

"a horse with rider, as seen from a distance by a naive innocent."

*/

很重要的一Ҏ(gu)注意变量是否是在其所属范围的开始处声明的。有时这会导致意想不到的情况?

tweak();

var aNumber = 100;

function tweak() {

var newThing = 0; // 昑ּ声明 newThing 变量?

// 本语句将未定义的变量赋给 newThingQ因为已有名?aNumber 的局部变量?

newThing = aNumber;

//下一条语句将?42 赋给局部的 aNumber。aNumber = 42;

if (false) {

var aNumber; // 该语句永q不会执行?

aNumber = 123; // 该语句永q不会执行?

} // 条g语句l束?

} // 该函数定义结束?

?JScript q行函数Ӟ首先查找所有的变量声明Q?

var someVariable;

q以未定义的初始值创建变量。如果变量被声明时有|

var someVariable = "something";

那么该变量仍以未定义的值初始化Qƈ且只有在q行了声明行时才被声明值取代,假如曄被声明过?

JScript 在运行代码前处理变量声明Q所以声明是位于一个条件块中还是其他某些结构中无关紧要。JScript 扑ֈ所有的变量后立卌行函C的代码。如果变量是在函C昑ּ声明?? 也就是说Q如果它出现于赋D辑ּ的左边但没有?var 声明 ? 那么把它创Zؓ全局变量?

复制、传递和比较数据

?JScript 中,Ҏ(gu)据的处理取决于该数据的类型?

按值和按引用的比较

Numbers ?Boolean cd的?(true ?false) 是按值来复制、传递和比较的。当按值复制或传递时Q将在计机内存中分配一块空间ƈ原值复制到其中。然后,即更改原来的|也不会媄响所复制的|反过来也一PQ因两个值是独立的实体?

对象、数l以及函数是按引用来复制、传递和比较的?当按地址复制或传递时Q实际是创徏一个指向原始项的指针,然后像拯一h使用该指针。如果随后更改原始项Q则同时更改原始项和复刉Q反q来也一P。实际上只有一个实体;“复本”q不是一个真正的复本Q而只是该数据的又一个引用?

当按引用比较Ӟ要想比较成功Q两个变量必d照完全相同的实体。例如,两个不同?Array 对象即包含相同的元素也比较ؓ不相{。要x较成功,其中一个变量必Mؓ另一个的参考。要x查两个数l是否包含了相同的元素,比较 toString() Ҏ(gu)的结果?

最后,字符串是按引用复制和传递的Q但是是按值来比较的。请注意Q假如有两个 String 对象Q用 new String("something") 创徏的)Q按引用比较它们Q但是,如果其中一个或者两者都是字W串值的话,按值比较它们?

注意 鉴于 ASCII?ANSI 字符集的构造方法,按序列顺序大写字母位于小写字母的前面。例?"Zoo" 于 "aardvark"。如果想执行不区分大写的匹配,可以对两个字W串调用 toUpperCase() ?toLowerCase()?

传递参数给函数

按g递一个参数给函数是制作该参数的一个独立复本,即一个只存在于该函数内的复本。即使按引用传递对象和数组Ӟ如果直接在函C用新D盖原先的|在函数外q不反映新倹{只有在对象的属性或者数l的元素改变Ӟ在函数外才可以看出?

例如Q?IE 对象模式Q:

// 本代码段破坏Q覆盖)其参敎ͼ所?

// 调用代码中反映不出变化?

function Clobber(param)

{

// 破坏参数Q在调用代码?

// 看不到?

param = new Object();

param.message = "This will not work";

}

// 本段代码改变参数的属性,

// 在调用代码中可看到属性改变?

function Update(param)

{

// 改变对象的属性;

// 可从调用代码中看到改变?

param.message = "I was changed";

}

// 创徏一个对象,q赋l一个属性?

var obj = new Object();

obj.message = "This is the original";

// 调用 ClobberQƈ输出 obj.message。注意,它没有发生变化?

Clobber(obj);

window.alert(obj.message); // 仍然昄 "This is the original"?

// 调用 UpdateQƈ输出 obj.message。注意,它已l被改变了?

Update(obj);

window.alert(obj.message); // 昄 "I was changed"?

验数?

当按D行检验时Q是比较两个截然不同的项以查看它们是否相{。通常Q该比较是逐字节进行的。当按引用进行检验时Q是看这两项是否是指向同一个原始项的指针。如果是Q则比较l果是相{;如果不是Q即使它们每个字节都包含完全一L|比较l果也ؓ不相{?

按引用复制和传递字W串能节U内存;但是׃在字W串被创建后不能q行更改Q因此可以按D行比较。这样可以检查两个字W串是否包含相同的内容,即它们是完全独立生的?



deepbluesea 2008-09-02 10:35 发表评论
]]>
查询L定日期最q的一条数据(oracleQ?/title><link>http://www.aygfsteel.com/deepbluesea/archive/2008/07/17/215396.html</link><dc:creator>deepbluesea</dc:creator><author>deepbluesea</author><pubDate>Thu, 17 Jul 2008 02:21:00 GMT</pubDate><guid>http://www.aygfsteel.com/deepbluesea/archive/2008/07/17/215396.html</guid><wfw:comment>http://www.aygfsteel.com/deepbluesea/comments/215396.html</wfw:comment><comments>http://www.aygfsteel.com/deepbluesea/archive/2008/07/17/215396.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/deepbluesea/comments/commentRss/215396.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/deepbluesea/services/trackbacks/215396.html</trackback:ping><description><![CDATA[select * from <br /> (Select   *   from   t_currency_rate<br /> where f_orig_curr='USD'<br /> and f_dest_curr='RMB'<br /> Order   by   abs(f_date-sysdate) ) a<br /> where rownum=1 <img src ="http://www.aygfsteel.com/deepbluesea/aggbug/215396.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/deepbluesea/" target="_blank">deepbluesea</a> 2008-07-17 10:21 <a href="http://www.aygfsteel.com/deepbluesea/archive/2008/07/17/215396.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>对不P我的邮g发错了h。翻译成英文http://www.aygfsteel.com/deepbluesea/archive/2008/06/04/205750.htmldeepblueseadeepblueseaWed, 04 Jun 2008 03:29:00 GMThttp://www.aygfsteel.com/deepbluesea/archive/2008/06/04/205750.htmlhttp://www.aygfsteel.com/deepbluesea/comments/205750.htmlhttp://www.aygfsteel.com/deepbluesea/archive/2008/06/04/205750.html#Feedback2http://www.aygfsteel.com/deepbluesea/comments/commentRss/205750.htmlhttp://www.aygfsteel.com/deepbluesea/services/trackbacks/205750.htmlI am sorry. My mail was wrongly addressed to you.

deepbluesea 2008-06-04 11:29 发表评论
]]>
止右键、选择、粘贴、shift、ctrl、alt.....http://www.aygfsteel.com/deepbluesea/archive/2008/05/29/203867.htmldeepblueseadeepblueseaThu, 29 May 2008 08:07:00 GMThttp://www.aygfsteel.com/deepbluesea/archive/2008/05/29/203867.htmlhttp://www.aygfsteel.com/deepbluesea/comments/203867.htmlhttp://www.aygfsteel.com/deepbluesea/archive/2008/05/29/203867.html#Feedback0http://www.aygfsteel.com/deepbluesea/comments/commentRss/203867.htmlhttp://www.aygfsteel.com/deepbluesea/services/trackbacks/203867.html <!--
function key(){
if(event.shiftKey){
window.close();}
//止shift
if(event.altKey){
window.close();}
//止alt
if(event.ctrlKey){
window.close();}
//止ctrl
return false;}
document.onkeydown=key;
if (window.Event)
document.captureEvents(Event.MOUSEUP);
//swordmaple javascript article.
//from www.jx165.com
function nocontextmenu(){
event.cancelBubble = true
event.returnValue = false;
return false;}
function norightclick(e){
if (window.Event){
if (e.which == 2 || e.which == 3)
return false;}
else
if (event.button == 2 || event.button == 3){
event.cancelBubble = true
event.returnValue = false;
return false;}
}
//止右键
document.oncontextmenu = nocontextmenu;  // for IE5+
document.onmousedown = norightclick;  // for all others
//-->
</script>
<body onselectstart="return false"; onpaste="return false";>
选择字符试试1010110
<input size=30>
<!--onselectstart止选择 onpaste止_脓(chung)-->


deepbluesea 2008-05-29 16:07 发表评论
]]>
վ֩ģ壺 ɽ| | | Ժ| ľ| Դ| | Ϫ| | | | | ʹ| ƴ| | ƽ½| ¬| | | | | ߴ| | | | | μ| | | ˮ| żҽ| Դ| ɽ| | ƽ| ƽ| ͤ| | Ԫ| ͬ| |