smallpig 发表于 2008-1-24 23:55

关于Javascript 问题

有一段javacript如下, 有人知道为何javacript 1.2为何 要另外加一段代码处理吗??谢谢
<script language="Javascript" type="text/javascript"><!-- gVersion="1.0"; //-->
</script>
<script language="Javascript1.1" type="text/javascript"><!-- gVersion="1.1"; //-->
</script>
<script language="Javascript1.2" type="text/javascript"><!-- gVersion="1.2"; var RE={"%09":/\t/g,"%20":/ /g,"%23":/\#/g,"%26":/\&/g,"%2B":/\+/g,"%3F":/\?/g,"%5C":/\\/g}; //-->
</script>
<script language="Javascript1.3" type="text/javascript"><!-- gVersion="1.3"; //-->
</script>
<script language="Javascript1.4" type="text/javascript"><!-- gVersion="1.4"; //-->
</script>
<script language="Javascript1.5" type="text/javascript"><!-- gVersion="1.5"; //-->
</script>
<noscript>
<img name="dcsimg" width="1" height="1" alt=" " src="http://www1.member-hsbc-group.com/insert_own_entity_dcs_id_here/njs.gif?dcsuri=/nojavascript&WT.js=No" />
</noscript>

iptton 发表于 2008-1-25 00:37

没有上下文...RE这个变量是做什么的?
是从什么库里摘出来的?

smallpig 发表于 2008-1-25 01:10

RE 这个可以看成是正则表达式,负责修改有问题的参数


Regular expression list used to URL encode query parameter values


URL Encoding
Certain characters can cause problems when used in query parameter values.
For example, for a WebTrends query parameter assignment of WT.ti="The Gettysburg Address"; SDC writes the following value to the log file:

&WT.ti=The Gettysburg Address

The space characters in this value cause problems because the space character is used to separate fields within a log file.
The solution is to URL encode all query parameter values.

URL encoding means replacing certain characters with their hexadecimal equivalents of the form %XX where % is the escaping character and XX is the character’s numeric ASCII value.

URL encoded characters are properly rendered in WebTrends reports.

Continuing with this example, the URL-encoded form is as follows:

&WT.ti=The%20Gettysburg%20Address

Note that space characters have been replaced by %20.

The tag URL encodes the following characters: tab, space, #, &, +, ?, ", \, and non-breaking spaces.
These characters are defined in the regular expression list.
The regular expression list contains regular expressions to search for, and the corresponding %XX replacement strings.

Regular expression properties are used as arguments to the string.replace method.

The tag URL encodes parameter values by passing them as arguments into the dcsEscape function.

[ 本帖最后由 smallpig 于 2008-1-25 01:12 编辑 ]

smallpig 发表于 2008-1-25 01:13

或许我这样问一下,javacript 1.2和其他版本之间有什么主要区别吗?? 或者 javacript 1.2 有什么主要缺点??

iptton 发表于 2008-1-25 14:23

没留意过这方面 的东西..
基本上都是用1.5了...
就像不大必要考虑IE5及其以下版本一样..

不过也想知道这方面的知识,期待有人回答..

iptton 发表于 2008-1-25 14:24

RE是一个JSON OBJECT吧,要看应用才能知道 1.2在这方面的缺点是什么..
页: [1]
查看完整版本: 关于Javascript 问题