📄 index.html
字号:
</tr>
</table>
</fieldset><br><br><a name="class_3"></a><fieldset class="class">
<legend>
Class JSON <a class="notForPrint" href="#top" style="text-decoration:none;">^</a></legend>
<div class="cDescription">Comes up with functionality for JSON (http://json.org) to use within ASP.
Correct escaping of characters, generating JSON Grammer out of ASP datatypes and structures</div>
<table cellspacing="0" cellpadding="3" border="0">
<tr>
<td class="label">Version:</td>
<td>1.1</td>
</tr>
<tr>
<td class="label">Author:</td>
<td>Michal Gabrukiewicz (gabru at grafix.at), Michael Rebec on 2007-04-26 12:46</td>
</tr>
<tr>
<td class="label">Last modified:</td>
<td>01.07.2007 23:14:40</td>
</tr>
<tr>
<td class="label">Path:</td>
<td>/ajaxed/class_JSON/JSON.asp</td>
</tr>
</table>
<h2><span onclick="toggle('props_3')" style="cursor:pointer">Properties</span> <a href="#class_3" class="notForPrint" style="text-decoration:none;">^</a></h2>
<table id="props_3" style="display:none" class="table alwaysPrint" cellspacing="0" cellpadding="3" border="0">
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr valign="top">
<td class="property">toResponse</td>
<td class="type"><span class="type">bool</span> </td>
<td>should generated results be directly written to the response? default = false </td>
</tr>
</table>
<h2><span onclick="toggle('meths_3')" style="cursor:pointer">Methods</span> <a href="#class_3" class="notForPrint" style="text-decoration:none;">^</a></h2>
<table id="meths_3" class="table alwaysPrint" style="display:none" cellpadding="3" cellspacing="0" border="0">
<tr>
<td>
<div class="mName"><a href="#method_IDAXDJ0" onclick="toggle('mdetails_3IDAXDJ0')">clone
(
str n
)
</a></div>
<div class="mDesc"></div>
<div style="display:none" class="mdetails alwaysPrint" id="mdetails_3IDAXDJ0"><br><div><strong>byVal str</strong>
: </div>
<div><strong> n</strong>
: </div>
</div>
</td>
</tr>
<tr>
<td>
<div class="mName"><a href="#method_IDADBJ0" onclick="toggle('mdetails_3IDADBJ0')">escape
(
val
)
</a></div>
<div class="mDesc">STATIC! takes a given string and makes it JSON valid</div>
<div style="display:none" class="mdetails alwaysPrint" id="mdetails_3IDADBJ0">all characters which needs to be escaped are beeing replaced by their
unicode representation according to the
RFC4627#2.5 - http://www.ietf.org/rfc/rfc4627.txt?number=4627<br><br><div><strong> val</strong><span class="type">
(
<span class="type">string</span>
)
</span>
: value which should be escaped</div>
<div><strong>Return </strong>
(
<span class="type">string</span>
) :
JSON valid string</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="mName"><a href="#method_IDA3BJ0" onclick="toggle('mdetails_3IDA3BJ0')">toJSON
(
name val nested
)
</a></div>
<div class="mDesc">generates a representation of a name value pair in JSON grammer</div>
<div style="display:none" class="mdetails alwaysPrint" id="mdetails_3IDA3BJ0">the generation is done fully recursive so the value can be a complex datatype as well. e.g.
toJSON("n", array(array(), 2, true), false) or toJSON("n", array(RS, dict, false), false), etc.<br><br><div><strong> name</strong><span class="type">
(
<span class="type">string</span>
)
</span>
: name of the value (accessible with javascript afterwards). leave empty to get just the value</div>
<div><strong> val</strong><span class="type">
(
<span class="type">variant</span> <span class="type">int</span> <span class="type">float</span> <span class="type">array</span> <span class="type">object</span> <a class="type" href="http://www.w3schools.com/asp/asp_ref_dictionary.asp" target="_blank">dictionary</a> <a class="type" href="http://www.w3schools.com/ado/ado_ref_recordset.asp" target="_blank">recordset</a>
)
</span>
: value which needs
to be generated. Conversation of the data types (ASP datatype -> Javascript datatype):
NOTHING, NULL -> null, ARRAY -> array, BOOL -> bool, OBJECT -> name of the type,
DICTIONARY -> valuepairs. each key is accessible as property afterwards
RECORDSET -> array where each row of the recordset represents a field in the array.
fields have properties named after the column names of the recordset (LOWERCASED!)
e.g. generate(RS) can be used afterwards r[0].ID
INT, FLOAT -> number
OBJECT with reflect() method -> returned as object which can be used within JavaScript</div>
<div><strong> nested</strong><span class="type">
(
<span class="type">bool</span>
)
</span>
: is the value pair already nested within another? if yes then the {} are left out.</div>
<div><strong>Return </strong>
(
<span class="type">string</span>
) :
returns a JSON representation of the given name value pair
(if toResponse is on then the return is written directly to the response and nothing is returned)</div>
</div>
</td>
</tr>
</table>
</fieldset><br><br><a name="class_4"></a><fieldset class="class">
<legend>
Class Library <a class="notForPrint" href="#top" style="text-decoration:none;">^</a></legend>
<div class="cDescription">This class holds all general methods used within the library. They are accessible
through an already existing instance called "lib". It represents the Library itself somehow.
Thats why e.g. its possible to get the current version of the library using lib.version</div>
<table cellspacing="0" cellpadding="3" border="0">
<tr>
<td class="label">Version:</td>
<td>1.0</td>
</tr>
<tr>
<td class="label">Author:</td>
<td>Michal Gabrukiewicz - gabru @ grafix.at on 12.09.2003</td>
</tr>
<tr>
<td class="label">Last modified:</td>
<td>08.07.2007 17:57:04</td>
</tr>
<tr>
<td class="label">Static:</td>
<td>lib</td>
</tr>
<tr>
<td class="label">Path:</td>
<td>/ajaxed/class_library/library.asp</td>
</tr>
</table>
<h2><span onclick="toggle('props_4')" style="cursor:pointer">Properties</span> <a href="#class_4" class="notForPrint" style="text-decoration:none;">^</a></h2>
<table id="props_4" style="display:none" class="table alwaysPrint" cellspacing="0" cellpadding="3" border="0">
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr valign="top">
<td class="property">browser</td>
<td class="type"><span class="type">string</span> </td>
<td>GET: gets the browser (uppercased shortcut) which is used. version is ignored. e.g. FF, IE, etc. empty if unknown </td>
</tr>
<tr valign="top">
<td class="property">page</td>
<td class="type"><a class="type" href="#class_1">AjaxedPage</a> </td>
<td>holds the current executing page. Nothing if there is not page </td>
</tr>
<tr valign="top">
<td class="property">version</td>
<td class="type"><span class="type">string</span> </td>
<td>GET: gets the version of the whole library </td>
</tr>
</table>
<h2><span onclick="toggle('meths_4')" style="cursor:pointer">Methods</span> <a href="#class_4" class="notForPrint" style="text-decoration:none;">^</a></h2>
<table id="meths_4" class="table alwaysPrint" style="display:none" cellpadding="3" cellspacing="0" border="0">
<tr>
<td>
<div class="mName"><a href="#method_IDAOIJ0" onclick="toggle('mdetails_4IDAOIJ0')">[error]
(
msg
)
</a></div>
<div class="mDesc">writes an error and ends the response. for unexpected errors</div>
<div style="display:none" class="mdetails alwaysPrint" id="mdetails_4IDAOIJ0">this error should be used for any unexpected errors. In comparison to throwError
it should only be used if a common error message should be displayed to the user instead of
raising a real ASP error (throwError).
- if buffering is turned off then the already written response won't be cleared.<br><br><div><strong> msg</strong><span class="type">
(
<span class="type">string</span>
)
</span>
: error message</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="mName"><a href="#method_IDAIJJ0" onclick="toggle('mdetails_4IDAIJJ0')">getGUID
(
)
</a></div>
<div class="mDesc">gets a new globally unique Identifier.</div>
<div style="display:none" class="mdetails alwaysPrint" id="mdetails_4IDAIJJ0">
<div><strong>Return </strong>
(
<span class="type">string</span>
) :
new guid without hyphens. (hexa-decimal)</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="mName"><a href="#method_IDAWLJ0" onclick="toggle('mdetails_4IDAWLJ0')">getUniqueID
(
)
</a></div>
<div class="mDesc">Returns an unique ID for each pagerequest, starting with 1</div>
<div style="display:none" class="mdetails alwaysPrint" id="mdetails_4IDAWLJ0">
<div><strong>Return </strong>
(
<span class="type">int</span>
) :
uniqueID : the unique id</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="mName"><a href="#method_IDAANJ0" onclick="toggle('mdetails_4IDAANJ0')">iif
(
i j k
)
</a></div>
<div class="mDesc"></div>
<div style="display:none" class="mdetails alwaysPrint" id="mdetails_4IDAANJ0">This will replace the IIf function that is missing from the intrinsic functions of ASP<br><br><div><strong> i</strong><span class="type">
(
<span class="type">variant</span>
)
</span>
: condition</div>
<div><strong> j</strong><span class="type">
(
<span class="type">variant</span>
)
</span>
: expression 1</div>
<div><strong> k</strong><span class="type">
(
<span class="type">variant</span>
)
</span>
: expression 2</div>
<div><strong>Return </strong>
(
<span class="type">string</span>
) :
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="mName"><a href="#method_IDAYJJ0" onclick="toggle('mdetails_4IDAYJJ0')">init
(
var default
)
</a></div>
<div class="mDesc">initializes a variable with a default value if the variable is not set set (isEmpty)</div>
<div style="display:none" class="mdetails alwaysPrint" id="mdetails_4IDAYJJ0"><br><div><strong> var</strong><span class="type">
(
<span class="type">variant</span>
)
</span>
: some variable</div>
<div><strong> default</strong><span class="type">
(
<span class="type">variant</span>
)
</span>
: the default value which should be taken if the var is not set</div>
<div><strong>Return </strong>
(
<span class="type">variant</span>
) :
if var is set then the var otherwise the default value.</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="mName"><a href="#method_IDAVGJ0" onclick="toggle('mdetails_4IDAVGJ0')">newDict
(
values
)
</a></div>
<div class="mDesc">gets a new dictionary filled with a list of values</div>
<div style="display:none" class="mdetails alwaysPrint" id="mdetails_4IDAVGJ0"><br><div><strong> values</strong><span class="type">
(
<span class="type">array</span>
)
</span>
: values to fill into the dictionary. array( array(key, value), arrray(key, value) )
if the fields are not arrays (valuepairs) then the key is generated automatically. if no array
provided then an empty dictionary is returned</div>
<div><strong>Return </strong>
(
<a class="type" href="http://www.w3schools.com/asp/asp_ref_dictionary.asp" target="_blank">dictionary</a>
) :
dictionary with values.</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="mName"><a href="#method_IDA2KJ0" onclick="toggle('mdetails_4IDA2KJ0')">sleep
(
seconds
)
</a></div>
<div class="mDesc">Sleeps for a specified time. for a while :)</div>
<div style="display:none" class="mdetails alwaysPrint" id="mdetails_4IDA2KJ0"><br><div><strong> seconds</strong><span class="type">
(
<span class="type">int</span>
)
</span>
: how many seconds. Minmum 1, Maximum 20. Value will be autochanged if value
is incorrect.</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="mName"><a href="#method_IDAPHJ0" onclick="toggle('mdetails_4IDAPHJ0')">throwError
(
args
)
</a></div>
<div class="mDesc">throws an ASP runtime Error which can be handled with on error resume next</div>
<div style="display:none" class="mdetails alwaysPrint" id="mdetails_4IDAPHJ0">if you want to throw an error where just the user should be notified use lib.error instead<br><br><div><strong> args</strong><span class="type">
(
<span class="type">array</span> <span class="type">string</span>
)
</span>
:
- if array then fields => number, source, description
- The number range for user errors is 512 (exclusive) - 1024 (exclusive)
- if args is a string then its handled as the description and an error is raised with the
number 1024 (highest possible number for user defined VBScript errors)</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="mName"><a href="#method_IDAGMJ0" onclick="toggle('mdetails_4IDAGMJ0')">URLDecode
(
endcodedText
)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -