Association menu. Level 3

xiaoxiao2021-03-06  14

associated menu </ title></p> <p><Script></p> <p>/ * Instructions for use: 1. Do not change the location of the code, you only need to change the text in <XML> </ XML> and <form> <form /> tag, the value value can be. 2. Other web design contents are added to <form> <form />. 3. Script alertForm is a pop-up window, which can be removed for the correctness of the associated menu for an intuitive verification. 4. When you are used, you remove unnecessary comments. 5. This example comes from the Internet 2005.02.17</p> <p>* /</p> <p>function AttachXMLForSelect (xd, arr, defaultText, defaultValue) // xd: xmldom, arr: array of select {function EnsureString (str) {if (typeof (str) == "string") return str; if (str == null Return ""; try {return str ";} catch (x) {} return";} defaultText = Ensurestring (DefaultText); DefaultValue = Ensurestring (DefaultValue);</p> <p>// Check the parameter IF (xd == null || xd.documentelement == null || arr == null || arr.length == 0) throw (New Error (-1, "invalid arguments");</p> <p>// Convert into internal XD (Function (XMLDOM) {xd = new activXObject ("Microsoft.xmLDom"); xd.loadXML (XMLDom.xml);}) (XD)</p> <p>// Release SELECT, replace it with uniqueid to store for (VAR i = 0; i <arr.length; i ) arr [i] = {UNIQUEID: Arr [i] .uniqueID, Node: null // Currently related XML Node, attach: false // is currently associated with OnseTChange};</p> <p>// Set the first SELECT related XML Node as an XML root element Arr [0] .Node = xd.documentelement;</p> <p>// Associate the first SELECT REATTACHNODE (0);</p> <p>Var controller = {</p> <p>Handlechange: handlechange</p> <p>}</p> <p>Return Controller;</p> <p>/ / Respond to the user's operation function overselectchange (Event) {handlechange (at.srcelement);} // Handling SELECT may be modified, confirm the back Select normal function handlechange (s) {// get the location in the Arr in Arr for (var index = 0; index <arr.length; index ) {if (s.uniqueid == arr [index] .uniqueid) Break;} // If not the last SELECT IF (INDEX <arr.length-1) { VAR node = arr [index] .Node; // Related to the next Select related XML node if (node) {var xns = node.selectnodes ("item"); arr [index 1] .Node = xns.Item S.SelectedIndex);} else arr [index 1] .Node = NULL;</p> <p>// Related to the next SELECT / * Association Recurns * / ReattachNode (INDEX 1);}}</p> <p>// Association, retrans part of a select to the specified Node Function ReattachNode (index) {// Take the current associated Node Var Node = arr [index] .Node; var pnode = null; if (index> 0) Pnode = arr [ Index] .Node;</p> <p>// Take the current select var s = document.getlementByid (arr [index] .unique); // clearly clear the content S. Innerhtml = "" "</p> <p>// If there is defaulttext, set one IF ((node ​​== null || node.selectnodes ("item"). Length == 0) && defaultText) {var o = document.createElement ("option"); o. Value = defaultValue; o.innertext = defaultText; S.Appendchild (O);</p> <p>/ / If the associated Node is empty, cancel the event association if (node ​​== null) {if (arr [index] .attach) {s.detachevent ("onchange", OnsectChange); arr [index] .attach = false }</p> <p>/ * Associated recursive * / handlechange (s); return;}</p> <p>// If node is not empty</p> <p>/ / Re-association event if (arr [index] .attach == false) {s.attachevent ("onchange", OnsectChange); arr [index] .attach = true;}</p> <p>// Pall the value of the child into the value of Var xns = node.selectnodes ("item"); for (var i = 0; i <xns.length; i ) {var o = document.createElement ("option" ); O.Value = xns.Item (i) .getattribute ("value"); o.innertext = xns.Item (i) .getattribute ("text"); S.Appendchild (O);} // This. . . Maybe you may not need. . . IF (S.Options.Length) s.selectedIndex = 0;</p> <p>/ * Associated recursive * / handlechange (s);}}</p> <p></ Script> <ipml id = OXML> <item> <item text = "text1" value = "value1"> <item text = "text11" value = "value11"> <item text = "text111" value = "value111 "/> <Item text =" text12 "value =" value112 "/> <item text =" text113 "value =" value113 "/> <item text =" text114 "value =" value114 "/> <ip Item text = "text12" value = "value12"> <item text = "text121" value = "value121" /> <item text = "text122" value = "value122" /> <item text = "text123" value = " Value123 "/> <item text =" text124 "value =" value124 "/> <ipem> <item text =" text13 "value =" value13> <item text = "text131" value = "value131" /> < Item text = "text132" value = "value132" /> <item text = "text133" value = "value133" /> <item text = "text134" value = "value134" /> <item> <item text = " TEXT14 "Value =" Value14 "> <item text =" text141 "value =" value141 "/> <item text =" text142 "value =" value142 "/> <item text =" text143 "value =" value143 "/> <item text = "text144" value = "value144" /> <item text = "text2" value = "value2"> <item text = "text21" value = "VALUE 21></p> <p><item text = "text211" value = "value211" /> <item text = "text212" value = "value212" /> <item text = "text213" value = "value213" /> <item text = "text214" VALUE = "Value214" /> </ item> <item text = "text22" value = "value22"> <item text = "text221" value = "value221" /> <item text = "text222" value = "value222" / > <Item text = "text223" value = "value223" /> <item text = "text24" value = "value224" /> </ item> <item text = "text23" value = "value23> <item text = "Text231" value = "value231" /> <item text = "text232" value = "value232" /> <item text = "text233" value = "value233" /> <item text = "text234" value = "value234" /> </ Item> <item text = "text24" value = "value24"> <item text = "text241" value = "value241" /> <item text = "text242" value = "value242" /> <item text = "text243" value = "value243" /> <item text = "text244" value = "value244" /> </ item> </ item> </ item> </ xml></p> <p><Script> function alertform (f) {Alert ("S1: / T" GetSelectOption (f ("S1")). InnerText "/ T: / T" GetSelectOption (f ("S1")). Value "/ r / n" "S2: / T" GetSelectOption (f ("S2")). InnerText "/ T: / T" GetSelectOption (f ("s2")). Value "/ r / N " " S3: / T " GetSelectOption (f (" s3 ")). InnerText " / T: / T " GetSelectOption (f (" s3 ")). Value " / r / n "); Return Event.ReturnValue = false;} Function GetSelectOption (s) {Return S (S.Selected ";} </ script> </ head> <body> <form id = f1 οnsubmit = alertform (this)> <select style = "Width: 100px" name = S1> <option value = value1 selected> text1 </ option> <option value = value2> text2 </ option> </ select> <select style = "width: 100px" name = S2> < Option value = value11 selected> text11 </ option> <option value = value12> text12 </ option> <option value = value13> text13 </ option> <option value = value14> text14 </ option> </ select> <select Style = "width: 100px" Name = S3> <option value = value111 selected> text11 </ option> <option value = value112> text112 </ option> <option value = value1 13> Text113 </ option> <option value = value114> text114 </ option> </ select> <input type = submit value = Submit query> </ form> <input id = INPSAVE style = "Behavior: URL (# Default # savehistory) "Type = Hidden Value = 000></p> <p><Script> var c = attachXMLFORSELECT (OXML.XMLDocument, [F1 ("S1"), F1 ("S2"), F1 ("S3")]); // Exposure Controller is because IE5.0 does not provide FireEvent, 555555 // The following code is stored. Function window.onLoad () {var sis = INPSAVE.VALUE; F1 ("S1"). SelectedIndex = PARSEINT (Sis.Charat (0)); C.Handlechange (F1 ("S1")); F1 ("S2" ) .SelectedIndex = PARSEINT (Sis.Charat (1)); C.Handlechange (F1 ("S2")); F1 ("S3"). SelectedIndex = PARSEINT (Sis.Charat (2)); C.handlechange (F1 ("S3"));} function window.onbeforeunload () {INPSAVE.VALUE = "" f1 ("S1"). SELECTEDEX F1 ("S2"). SELECTEDEX F1 ("s3"). SELECTedIndex;} </ Script></p> <p></ body> </ html></p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-47342.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="47342" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.033</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'U46aPPdvuM0GukAOn2FJRyX6nabVFlJ4GSuxRPXXy2RSgj8fxbGyW64wd6E_2FXMzTrTKRntawQOfVjnd6IrBWWw_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>