在开å‘B(t¨¤i)/S½E‹åºæ—Óž¼Œæˆ‘们¾l常ä¼?x¨¬)ä‹É用到一些页é¢çñ”的效果控件。比如:(x¨¬)æ ?w¨¨i)åŞ目录åQŒComboBox和一些其他的控äšgåQŒç”±äºŽè¿™äº›æŽ§ä»¶çš„å˜åœ¨ä½¿å¾—我们的程åºå¼‚常的夺目。但是在开å‘这些控件的时候或多或ž®‘的都会(x¨¬)比较éºÈƒ¦(ch¨³)。而大部分的程åºå‘˜æ˜¯ä‹É用å‘布的一些开æºçš„JS控äšgæ¥å‡è½Õd·¥ä½œé‡è€Œä¸”也ä‹É得自å·Þqš„½E‹åºå¥å£®ã€‚䏋颿ˆ‘介ç»ä¸€ä¸ªåœ¨å¼€æºç¤¾åŒÞZ¸èµ«èµ«æœ‰åçš„æ ‘(w¨¨i)形控ä»Óž¼š(x¨¬)TreeViewã€?
首先介ç»ä¸€ä¸‹TreeViewåQŒTreeViewåŽŸåæ˜¯FolderTreeåQŒæ˜¯ä¸€‹Æ¾æ¯”较早ž®±å‡ºä¸–çš„æ ?w¨¨i)åÅžJS控äšgåQŒå½“时是ç”׃¸ªäººå¼€å‘çš„åQŒä¹‹åŽç”±å…¬å¸è´ä¹°äº?ji¨£n)。但是现在还å¯ä»¥å…费使用ã€?/p>
TreeView 有两个JSæ–‡äšgå’Œä¸€äº›èµ„æºæ–‡ä»¶ç»„æˆã€‚两个JSæ–‡äšg分别是:(x¨¬)主è¦å®žçŽ°åŠŸèƒ½çš„ftiens4.js和实现多‹¹è§ˆå™¨æ”¯æŒçš„ua.jsæ–‡äšgã€‚åªæœ‰æˆ‘们在开å‘çš„™åµé¢ä¸åŠ å…¥å¦‚ä¸Šä¸¤ä¸ªæ–‡ä»¶çš„è¯å°±å¯ä»¥å¼€å‘如上图所昄¡¤ºçš„æ ‘(w¨¨i)形目录了(ji¨£n)。代ç 如下:(x¨¬)
<html>
<head>
<script type="text/javascript" src="../treeview/ftiens4.js" ></script>
<script type="text/javascript" src="../treeview/ua.js" ></script>
<script type="text/javascript">
//TreeView 环境å˜é‡
BUILDALL = 0 //åˆ›å¾æ‰€æœ‰çš„节点对象 0:å»¶æ—¶åˆ›å¾ 1:ç«‹å³åˆ›å¾
GLOBALTARGET = 'R' //èŠ‚ç‚¹è§¦å‘æ—¶çš„ç›®æ ‡ 'B':打开新窗å?'R':匙¾¹çš„Frame 'S':当å‰Frame 'T':当剋¹è§ˆå™¨çª—å?br>HIGHLIGHT = 0 //高ä(sh¨´)º®æ˜„¡¤ºå½“å‰é€‰ä¸çš„节ç‚?0:ä¸é«˜?sh¨´)º®æ˜¾½C?1:高ä(sh¨´)º®æ˜„¡¤º
HIGHLIGHT_BG = 'blue' //高ä(sh¨´)º®æ˜„¡¤ºçš„背景颜è‰?br>HIGHLIGHT_COLOR = 'white' //高ä(sh¨´)º®æ˜„¡¤ºçš„颜è‰?br>ICONPATH = '' //指定节点的显½Cºå›¾æ ‡ï¼Œä½¿ç”¨URLæ–¹å¼åQŒè€Œä¸”å¿…é¡»ç”?/"¾l“å°¾ å¦?http://www.x.com/y/
PRESERVESTATE = 0 //ä¿å˜TreeView的状æ€åˆ°Cookieä¸ï¼Œå½“冋ơ显½Cºçš„æ—¶å€™ä¼š(x¨¬)自动的回¾|®çжæ€?0:ä¸ä¿å?1:ä¿å˜
STARTALLOPEN = 0 //默认打开所有节ç‚?0:åªæ‰“å¼€æ ¹èŠ‚ç‚?1:打开所以节ç‚?br>USEFRAMES = 1 //™åµé¢æ˜¯å¦ä½¿ç”¨äº?ji¨£n)Frame,注æ„åQšå¦‚果未使用Frame一定è¦è®„¡½®æ¤å‚æ•?0:未ä‹Éç”?1:使用äº?br>USEICONS = 1 //是å¦ä½¿ç”¨å›¾æ ‡ 0:䏿˜¾½Cºå›¾æ ?1:昄¡¤ºå›¾æ ‡
USETEXTLINKS = 0 //èŠ‚ç‚¹æ–‡å—æ˜¯å¦ä¸ºé“¾æŽ?0:å?1:æ˜?br>WRAPTEXT = 0 //节点昄¡¤º‘…å‡ºä¸€è¡Œæ—¶æ˜¯å¦æŠ˜è¡Œ 0:ä¸æŠ˜è¡?1:折行foldersTree = gFld("test", "") //创å¾ä¸€ä¸ªåä¸?test"çš„æ ¹èŠ‚ç‚¹
foldersTree.treeID = "t1" //讄¡½®test节点的唯一¾~–å·ä¸?t1"
aux1 = insFld(foldersTree, gFld("Day of the week", "b.html")) //åœ¨æ ¹èŠ‚ç‚¹ä¸åŠ å…¥ä¸€ä¸ªåä¸?Day of the week"çš„å节点,当点å‡Èš„æ—¶å€™æ‰“å¼€b.html
aux1.addChildren([["1","1.html"],["2","2.html"],["3","3.html"],["4","4.html"],["5","5.html"]]) //在aux1节点ä¸è¿ž¾låŠ å…?,2,3,4,5节点åQŒåƈ相应的打开1.html,2.html,3.html,4.html,5.html.aux2 = insFld(foldersTree, gLnk("R","Day of the week2", "b.html")) //åœ¨æ ¹èŠ‚ç‚¹ä¸åŠ å…¥åä¸?Day of the week2"的节点,当点å‡Èš„æ—¶å€™åœ¨å³ä¾§çš„frame䏿‰“å¼€b.html
aux3 = insDoc(foldersTree, gLnk("R","<input type=\"checkbox\">Day of the week3", "c.html")) //åœ¨æ ¹èŠ‚ç‚¹ä¸åŠ å…¥åä¸?Day of the week3"òq¶å¸¦æœ‰å¤é€‰æ¡†çš„节点,当点å‡Èš„æ—¶å€™åœ¨å³ä¾§çš„frame䏿‰“å¼€c.html
</script>
</head>
<body>
<A style="font-size:7pt;text-decoration:none;color:silver" href=" target=_blank>Javascript Tree Menu</A>
<script type="text/javascript">
</body>
</html>
TreeViewä¸ä¸»è¦çš„æ–ÒŽ(gu¨©)³•:
gFld(Title, Link);//创å¾èŠ‚ç‚¹ 例:(x¨¬)gFld("Test A", "javascript:parent.op()")
Argument
Title
Specifies the text that appears in the folder name. This text can include simple HTML tags, such as enclosing formatting tags (i, b, div, and so on). It can even include an img tag if you want to place a small icon in the node name, such as a "new!" icon for example.
Link
Specifies an optional URL. The URL can be a simple file name like demoFramesetRightFrame.html or a string with protocol, domain, path, and file name like http://www.treeview.net/treemenu/demopics/beenthere_europe.gif.
gLnk(Target, Title, Link);//创å¾ä¸€ä¸ªå¸¦æœ‰é“¾æŽ¥çš„节点 例:(x¨¬)gLnk("B", "My File", http://www.mysite.com/MyFile.doc)
Argument
Target
Configures the target location for the link. Specify one of the following values:
"R": Open the document in the right frame (a frame named basefrm)
"B": Open the document in a new window
"T": Open the document in the current browser window, replacing the frameset if one exists
"S": Open the document in the current frame, replacing the tree
Note: This argument is case sensitive; make sure to use uppercase letters.
Title
Specifies the text that appears in the link. This text can include simple HTML tags, such as enclosing formatting tags (i, b, div, and so on). It can even include an img tag if you want to place a small icon in the node name, such as a "new!" icon for example.
Link
Specifies the URL of the document. This can be an absolute URL or a relative URL. Do not enter any other information in this string; adding a target parameter or an event handler will not work.
insFld(Parent Folder, Child Folder); //åœ¨çˆ¶èŠ‚ç‚¹ä¸æ’入一个å节点 例:(x¨¬)aux1 = insFld(foldersTree, gFld("Europe", "http..."))
Argument
Parent Folder
Specifies the parent folder. That is, this argument specifies the folder node in which you want to place the other folder node.
Child Folder
Specifies the child folder. That is, this argument specifies the folder node that you want to place under the parent folder node.
insDoc(Parent Folder, Document Node); //在节点ä¸åŠ å…¥ä¸€ä¸ªDom对象 例:(x¨¬)insDoc(aux2, gLnk("S", "Boston", "..."))
Argument
Parent Folder
Specifies the parent folder. That is, this argument specifies the folder node in which you want to place the document node.
Document Node
Specifies the document node. That is, this argument specifies the document node that you want to place in the parent folder node
更多的å‚考信æ¯åˆ° http://www.treeview.net/tv/instructions.asp
AutoSuggest技术实现的一¿Uç±»ä¼égºŽComboBoxä¼?x¨¬)自动的把输入框ä¸çš?/span>Valueå‘é€åˆ°Server自定义的解æžå‘é€çš„æ•°æ®åQŒç„¶åŽæŠŠ˜q”回数æ®é€šè¿‡XML方弘q”回åˆ?/span>AS冿 ¹æ?/span>Server的最新版本是autosuggest_v2.1.3AutoSuggestã€?/span>autosuggest_inquisitor.css与一ä¸?/span>test.phpâ”?nbsp;.DS_Store
â”?nbsp;._.DS_Store
â”?nbsp;._bsn.AutoSuggest_2.1.3.html
â”?nbsp;._test.php
â”?nbsp;bsn.AutoSuggest_2.1.3.html
â”?nbsp;test.php
â”?br />
├─css
â”?nbsp;â”?nbsp;.DS_Store
â”?nbsp;â”?nbsp;._.DS_Store
â”?nbsp;â”?nbsp;autosuggest_inquisitor.css
â”?nbsp;â”?br />
�nbsp;└─img_inquisitor
â”?nbsp; â”?nbsp;.DS_Store
â”?nbsp; â”?nbsp;._.DS_Store
â”?nbsp; â”?nbsp;._as_pointer.gif
â”?nbsp; â”?nbsp;._hl_corner_bl.gif
â”?nbsp; â”?nbsp;._hl_corner_br.gif
â”?nbsp; â”?nbsp;._hl_corner_tl.gif
â”?nbsp; â”?nbsp;._hl_corner_tr.gif
â”?nbsp; â”?nbsp;._ul_corner_bl.gif
â”?nbsp; â”?nbsp;._ul_corner_br.gif
â”?nbsp; â”?nbsp;._ul_corner_tl.gif
â”?nbsp; â”?nbsp;._ul_corner_tr.gif
â”?nbsp; â”?nbsp;as_pointer.gif
â”?nbsp; â”?nbsp;hl_corner_bl.gif
â”?nbsp; â”?nbsp;hl_corner_br.gif
â”?nbsp; â”?nbsp;hl_corner_tl.gif
â”?nbsp; â”?nbsp;hl_corner_tr.gif
â”?nbsp; â”?nbsp;ul_corner_bl.gif
â”?nbsp; â”?nbsp;ul_corner_br.gif
â”?nbsp; â”?nbsp;ul_corner_tl.gif
â”?nbsp; â”?nbsp;ul_corner_tr.gif
â”?nbsp; â”?br />
�nbsp; └─_source
â”?nbsp; .DS_Store
â”?nbsp; ._.DS_Store
â”?nbsp; ._as_pointer.png
â”?nbsp; ._li_corner.png
â”?nbsp; ._ul_corner.png
â”?nbsp; as_pointer.png
â”?nbsp; li_corner.png
â”?nbsp; ul_corner.png
â”?br />
└─js
.DS_Store
._.DS_Store
._bsn.AutoSuggest_2.1.3.js
bsn.AutoSuggest_2.1.3.js
bsn.AutoSuggest_2.1.3_comp.js
AutoSuggest¾cÕdº“åQŒå…¶ä¸ä¸»è¦çš„对象ž®±æ˜¯bsn.AutoSggestvar options_xml = {
script:function(input){return"suggestAction!userName.action?signer="+input; }, //(1).å¸¦æœ‰ä¼ é€æ•°æ®çš„è¯äh±‚路径åQŒå…¶ä¸input是输入框的valueã€?/span>
varname:"input", //(2).储å˜è¾“入框valueçš„å˜é‡å
delay:800, //(3).å‘é€è¯·æ±‚的延时旉™—´
cache:false, //(4).是妾~“å˜
noresults:"æ— ç¬¦åˆçš„记录åQ?/span>",//(5).当没有符åˆçš„æŸ¥è¯¢¾l“果时的æç¤ºä¿¡æ¯
timeout:10000,//(6).候选框åœç•™æ—‰™—´
callback: function(record){ document.getElementById("temp").value = record.value; } //(7).选择候选项åŽçš„回调函数
};
var as_xml = new bsn.AutoSuggest('signer', options_xml); //(8).创å¾autosuggest对象åQŒåƈ¾l‘定一个输入框
¾~–ç äº?ji¨£n)。其ä¸çš„傿•°è¡¨å¯ä»¥çœ‹ä¸‹è¡¨åQ?/span>
Property |
Type |
Default |
Description |
script |
String / Function |
- |
REQUIRED! |
varname |
String |
"input" |
Name of variable passed to script holding current input. |
minchars |
Integer |
1 |
Length of input required before AutoSuggest is triggered. |
className |
String |
"autosuggest" |
Value of the class name attribute added to the generated . |
delay |
Integer |
500 |
Number of milliseconds before an AutoSuggest AJAX request is fired. |
timeout |
Integer |
2500 |
Number of milliseconds before an AutoSuggest list closes itself. |
cache |
Boolean |
true |
Whether or not a results list should be cached during typing. |
offsety |
Integer |
-5 |
Vertical pixel offset from the text field. |
shownoresults |
Boolean |
true |
Whether to display a message when no results are returned. |
noresults |
String |
No results! |
No results message. |
callback |
Function |
A function taking one argument: an object
|
|
json |
Boolean |
false |
Whether or not a results are returned in JSON format. If not, script assumes results are in XML. |
maxentries |
Integer |
25 |
The maximum number of entries being returned by the script. (Should correspond to the LIMIT clause in the SQL query.) |
傿•°˜q”回åQŒå¦‚ä¸‹æ ¼å¼çš„xmlæ–¹å¼åQŒä¸˜q‡æˆ‘在这里就ä¸åœ¨æ¼”示äº?ji¨£n)ã€?br />
AutoSuggest的解å†Ïx(ch¨®ng)–¹å¼ï¼Œæä¾›çš?/span>js脚本文äšgåªæœ‰8.33 KB代ç è§£æžã€‹ã€?br />
更多信æ¯å¯æŸ¥é˜?http://www.brandspankingnew.net/archive/2007/02/ajax_auto_suggest_v2.html