JavaScript technology, often used in BS development, 2

xiaoxiao2021-03-06  97

3. The boundless box window that can be used after adding SP1! ! chromeless window </ title></p> <p><Script language = "jscript"> / * --- Special Thanks for andot --- * /</p> <p>/ * This folload code area designed and writen by windy_sk <seasonx@163.net> You can use it is ready, but u must held all the copyright items! * /</p> <p>/ * --- Thanks for andot Again --- * /</p> <p>VAR CW_WIDTH = 400; var CW_HEIGHT = 300; var CW_TOP = 100; var cw_left = 100; var new_url = "/"; var new_cw = window.createpopup (); var cw_body = new_cw.document.body; var content = "" ; var cSStext = "margin: 1px; color: black; border: 2px outset; border-style: expression (οnmοuseοut = οnmοuseup = function () {this.style.borderStyle = 'outset'}, οnmοusedοwn = function () {if (Event.Button! = 2) this.style.Borderstyle = 'INSET'}; Background-Color: ButtonFace; Width: 16px; Height: 14px; font-size: 12px; line-height: 11px; cursor: default; "</p> <p>// build windowinclude.startdownload (cw_url, function (source) {content = source};</p> <p>function insert_content () {var "temp ="; CW_Body.style.overflow = "hidden"; CW_Body.style.backgroundColor = "white"; CW_Body.style.border = "solid black 1px"; content = content.replace (/ <a ([^nclick='parent.open (this.href );return false' $ $ 10); temp = "<Table Width = 100% Height = 100% Cellpadding = 0 cellspacing = 0 border = 0> "; TEMP =" <tr style = '; font-size: 12px; background: # 0099cc; height: 20; cursor: default' οndblclick = / "max.innerText = max .innertext == '1'? '2': '1'; parent.if_max =! parent.if_max; parent.show_cw (); / "οnmοuseup = 'parent.drag_up (event)' οnmοusemοve = 'parent.drag_move ( event) 'οnmοusedοwn =' parent.drag_down (event) 'onselectstart =' return false 'οncοntextmenu =' return false '> "; temp =" <td style =' color: #ffffff; padding-left: 5px '> Chromeless Window for IE6 SP1 </ TD> "; TEMP =" <TD Style = 'Color: #ffff; Padding-Right: 5px;' Align = Right> "; Temp =" <span id = help οnclick = / " Alert ('Chromeless Window for IE6 SP1 - VER 1.0 // n // ncode by windy_sk // n // nspecial Thanks for andot') / "style = /" " CSSText " Font-Family: System; Padding-Right: 2px; / ">? </ Span>; temp =" <span id = min οnclick = 'parent.new_cw.hide (); parent.blur ) 'style = / " csstext " font-family: webdings; / "title =' minimum '> 0 </ span>"; temp = "<</p> <p>Span id = max οnclick = / "this.innertext = this.innerText == '1'? '2': '1'; parent.if_max =! parent.if_max; parent.show_cw (); /" style = / " " CSSText " Font-Family: Webdings; / "Title = 'maximum'> 1 </ span>"; temp = "<span id = close οnclick = 'parent.opener = null; parent.close ()' Style = / "" CSSText "Font-Family: System; Padding-Right: 2px; /" Title = 'close'> x </ span> "; temp =" </ td> </ tr> <tr> < TD colSpan = 2> "; temp =" <div id = include style = 'overflow: scroll; overflow-x: hidden; overflow-y: auto; height: 100%; width: " cw_width " "; Temp = Content; Temp = "</ div>"; TEMP = "</ td> </ tr> </ table>"; cw_body.innerhtml = Temp;} settimeout ("INSERT_CONTENT ()", 1000) ;</p> <p>VAR if_max = true; function show_cw () {WINDOW.MOVETO (1000, 10000); if (if_max) {new_cw.show (cw_top, cw_left, cw_width, cw_height); if (Typeof (new_cw.document.all.includ)! = "undefined") {new_cw.document.all.include.style.width = CW_WIDTH; new_cw.document.all.max.innertext = "1";}} else {new_cw.show (0, 0, screen.width, Screen.height); new_cw.document.all.include.style.width = Screen.width;}}</p> <p>Window.onfocus = show_cw; window.onResize = show_cw;</p> <p>//Move windowvar DRAG_X, DRAG_Y, DRAGING = FALSE</p> <p>Function DRAG_MOVE (E) {if (Draging) {new_cw.show (E.SCREENX-DRAG_X, E.SCREENY-DRAG_Y, CW_WIDTH, CW_HEIGHT); RETURN FALSE;}}</p> <p>function drag_down (e) {if (e.button == 2) return; if (New_CW.document.body.offsetWidth == screen.width && New_CW.document.body.offsetHeight == screen.height) return; drag_x = e .clientX; drag_y = e.clientY; draging = true; e.srcElement.setCapture ();} function drag_up (e) {draging = false; e.srcElement.releaseCapture (); if (New_CW.document.body.offsetWidth = = Screen.width && new_cw.document.body.offsetHeight == Screen.Height) Return; cw_top = E.SCREENX-DRAG_X; CW_LEFT = E.SCREENY-DRAG_Y;}</p> <p></ Script> </ html></p> <p>Verification of telephone numbers</p> <p>Requirements: (1) Phone number is made by numbers, "(", ")" and "-" (2) The phone number is 3 to 8 bits (3) If there is a zone code in the phone number, the area code is three or four Bit (4) Area No. "(", ")" or "-" and other parts (5) The mobile phone number is 11 or 12 bits, if it is 12 bits, then the first bit is 0 (6) 11 bits The first and second bit of the mobile phone number is "13" (7) 12-bit mobile phone number, the third bit is "13" according to these rules, and can be followed by the following regular expression: ( ^ [0-9] {3,4} / - [0-9] {3,8} $) | (^ [0-9] {3,8} $) | (^ / ([0-9] {3,4} /) [0-9] {3,8} $) | (^ 0 {0, 1} 13 [0-9] {9} $)</p> <p><script language = "java script"> function phonecheck (s) {var str = s; var rag = / (^ [0-9] {3, 4} / - [0-9] {3,8} $) (^ [0-9] {3,8} $) | (^ / ([0-9] {3, 4} /) [0-9] {3,8} $) | (^ 0 {0 1} 13 [0-9] {9} $) / alert (reg.test (str));} </ script> <input type = text name = "iPhone> <input type = button οnclick =" PhoneCheck (Document.all.iphone.value) "Value =" Check "></p> <p>It has an effect that does not echo in input non-digital characters, that is, the input of non-digital characters is not reacted. Function NumBersonly (Field, Event) {var Key, Keychar; if (Window.Event) {key = window.event.keycode;} else} {key = event.Which;} else {return true} keychar = String .fromcharcode (key); IF ((key == null) || (key == 0) || (key == 8) || (key == 9) || (key == 13) || (key == 13) || == 27)) {RETURN TRUE;} else IF (("0123456789."). Indexof (Keychar)> - 1) {window.status = ""; return true;} else {window.status = "Field Excepts NumBers Only "; Return False;}} Verification IP</p> <p>Str = Document.RegexpDemo.txtip.value; if (/ ^ (/ d {1, 3}) /. (/ d {1, 3}) /. (/ d {1, 3}) /. (/ D {1,3}) $ /. TEST (STR) == false) {WINDOW.ALERT ('error IP address format'); Document.RegexpDemo.txtip.select (); Document.RegexpDemo.txtip.focus () }} IF (regexp. $ 1 <1 || regexp. $ 1> 254 || regexp. $ 2 <0 || regexp. $ 3 <0 || regexp. $ 3> 254 || regexp. $ 4 <1 || regexp. $ 4> 254) {WINDOW.Alert ('error IP address'); Document.RegexpDemo.txtip.select (); Document.Regexpdemo.txtip.focus (); return;} // Remove Such as 010.020.020.03 0 var str = str.replace (/ 0 (/ d) / g, "$ 1"); str = str.replace (/ 0 (/ d) / g, "$ 1"); window. Alert (STR);</p> <p>/ / Take the source of the data (Limit Table) for the class // OBJ parameter of the data, default Table), the default first line is the field name row // GetTableData class provides the MOVENEXT method, the parameter is the list of tables, the number of bits, move down, The positive number moves down, negatively, the data // sort_DESC method obtains the specified column name // sort_DESC method, the specified column is arranged in descending sequence, and the specified column is arranged in ascending // GetData method Returns a field value The data array of specific values ​​provides data, which can perform other processing // delete methods to delete the current record, the array reduces one row // initialization, OBJ: Table name, Leftlen: LEFTLEN: Rightlen: The extra data length of the right side, Function GetTableData (Obj, Leftlen, Rightlen) {var myobj = document.all (obj); var irow = myobj.Rows.LENGTH; var ilen = myobj.rows [0] .Cells.LENGTH; VAR i, J;</p> <p>TableData = new array (); for (i = 0; i <irow; i ) {TableData = new array (); for (j = 0; j <ilen; j ) {TableStr = myobj.rows (i) .Cells (j) .innertext; TableStr = TableStr.Substring (Leftlen, TableStr.Length-Rightlen) .trim (); TableStr = TableStr.Replace (/ / / / / //n/ig, " "); TableData [J] = TableStr;}} this.tabledata = TableData; this.cols = this.tabledata [0] .length; this.rows = this.tableData.Length; this.rowIndex = 0;} function move (Step) {if (this.rowindex> = this.rows) {return}</p> <p>IF (Step == "|| TypeOf (STEP) ==" undefined ") {if (this.rowindex <this.rows-1) this.rowIndex ; Return;</p> <p>} Else {if (this.rowindex step <= this.rows-1 && this.rowIndex step> = 0) {this.rowindex = this.rowIndex step;} else {if (this.rowIndex STEP <0 ) {This.rowIndex = 0; return;}} (this.rowindex step> this.rows-1) {this.rowindex = this.rows-1; return;}}}}</p> <p>Function getfielddata (field) {var colIndex = -1; var i = 0; if (typeof (field) == "Number") {colorex = field;} else {for (i = 0; i <this.cols&& .rowindex <this.rows; i ) {if (this.tableData [0] == Field) {colorEx = i; break;}}} f (colorex! = - 1) {Return this.tableData [this.rowIndex] [colIndex];</p> <p>}</p> <p>Function sort_desc () {// Descendance var colorex = -1; var highindex = -1; dec_Array = new array (); var i, j; for (n = 0; n <arguments.length; n ) {Field = arguments [arguments.lendth-1-n]; for (i = 0; i <this.cols; i ) {if (this.tableData [0] == Field) {colIndex = i; break;}} f (colIndex = = -1) Return; Else {DESC_ARRAY [0] = this.tabledata [0]; for (i = 1; i <this.rows; i ) {dec_Array = this.tableData [1]; highIndex = 1; for J = 1; J <this.tableData.Length; J ) {IF (desc_Array [Colindex] <this.tableData [J]) {dec_Array = this.tabledata [J]; HIGHINDEX = J;}} IF HIGHINDEX! = - 1) this.tableData = this.tableData.slice (0, highindex) .concat (this.tabledata.slice);}} this.tabledata = desc_Array;} Return;}</p> <p>Function sort_asc () {// Ascending var colorex = -1; var highindex = -1; var i, j; for (n = 0; n <arguments.length; n ) {asc_Array = new array (); field = arguments [arguments.lendth-1-n]; for (i = 0; i <this.cols; i ) {if (this.tableData [0] == Field) {colIndex = i; break;}} f (colIndex = = -1) return; else {asc_Array [0] = this.tabledata [0]; for (i = 1; i <this.rows; i ) {asc_Array = this.tableData [1]; highIndex = 1; for J = 1; j <this.tableData.length; j ) {// identify the smallest column value if (ASC_ARRAY [Colindex]> this.tableData [J] [ColIndex]) {asc_Array = this.tableData [J]; HIGHINDEX = J;}}}} (HIGHINDEX! = - 1) this.tabledata = this.tabledata.slice (0, highIndex) .concat (this.tabledata.slice);} } this.tabledata = ASC_ARRAY;} Return;}</p> <p>Function getData (field, fieldvalue) {var colIndex = -1; var i, j;</p> <p>Getdata = new array (); if (typeof (field) == "undefined" || TypeOf (fieldValue) == "undefined") {return this.tabledata;} for (j = 0; j <this.cols; j ) {IF (THIS.TABLEDATA [0] [J] == Field) {colorex = j;}}}}}} (colorex! = - 1) {for (i = 1; i <this.rows; i ) {ix ( THIS.TABLEDATA [COLINDEX] == FieldValue) {getData = new array (); getData = this.tabledata;}}} Return Getdata;}}} Return GetData;}}} Return GetData;} Rowindex) .concat (this.rtabledata.slice (this.rowIndex 1, this.tableData.length); this.rows = this.tableData.Length; Return;} Function Updatefield (Field, FieldValue) {var colIndex = 1; var i = 0; if (typeof (field) == "Number") {colorEx = field;} else {for (i = 0; i <this.cols && this.rowindex <this.Rows; i ) { IF (this.tableData [0] == Field) {colorEx = i; break;}}} f (colorex! = - 1) {this.tableData [this.rowindex] [colorex] = fieldValue;}} function movefirst ) {this.rowIndex = 0;} function moves () {this.rowindex = THIS .rows-1;} function string.prototype.trim () {Return this.replace (/ (^ / s *) | (/ s * $) / g, "");} gettabledata.prototype.movenext = movenext; GetTableData.prototype.GetFieldData = getfielddata; GetTableData.prototype.Sort_asc = sort_asc; GetTableData.prototype.Sort_desc = sort_desc; GetTableData.prototype.GetData = getData; GetTableData.prototype.Delete = DeletE; GetTableData.prototype.UpdateField = updateField; getTableData. Prototype.movefirst = movefirst;</p> <p>Specific example: http://202.119.73.208/netean/com/test/jsprint.htm</p> <p>Call the check code in the onblur event in each text box, and write an EnkeyDown event in each text box, write an ENTER turn tab function // Enter to TabFunction Entertainment (Event.Srcelement.Type! = 'Button' && Event.Srcelement.Type! = 'Textarea' && Event.Keycode == 13) {Event.Keycode = 9;}}</p> <p>Sometimes you need free edit form - give you a small example of a free editable table, write a little mess, huh :)</p> <p>/ / =============================== start ==================== ================</p> <p><Html> <head> <meta http-equiv = "content-type" content = "text / html; charset = GB2312"> <title> test modification form </ title> <style> / * Tip layer style * / Div {Border-Right: # 80c144 1px solid; border-top: # 80c144 1px solid; Visibility: hidden; border-left: # 80c144 1px solid; cursor: default; line-height: 20px; border-bottom: # 80c144 1px SOLID; FONT-FAMILY: Song; Font-size: 12px; Position: absolute; background-color: # f6f6f6; top: 30px; Left: 30px;} / * TR style * / tr {font-family: "Song" Color: # 000000; Background-Color: # c1dbf5; font-size: 12px} / * Table footnote style * /. Trfoot {font-size: 12px; font-family: "Song", "Verdana", "Arial" Background-color: # 6699cc; color: #fffff; height: 25;} / * TrHead property * /. TrHead {font-size: 13px; font-family: "Song", "Verdana", "Arial"; Background -Color: # 77Aadd; Color: #fffffff; Height: 25;} / * Text Box Style * / Input {Border-Color: # aacef7 # aacef7 # aacef7 # aacef7; border-right: 1px solid; border-top: 1px Solid; Border-Left: 1px Solid; Border-Bottom: 1PX Solid; Font -Size: 12px; Font-Family: "Song Body", "Verdana"; Color: # 000000; Background-Color: # e9eff5;} / * Button Style * / Button {Border-Color: # aacef7 # aacef7 # aacef7 # aacef7 Background-color: # d5e4f3; cursor: hand; font-size: 12px; border-right: 1px solid; border-top: 1px solid; border-left: 1px solid; border-bottom: 1px solid; color: # 000000 } </ Style> </ head> <body> <script language = "java script"> <! - Global variable // flag bit, the value is the false representative has not opened an edit box, the value is True to open one Edit box Start Edit Var Editer_Table_cell_tag = false; // Turn on Edit Function Sign, Value is True to Allow Edit Var Run_Edit_Flag = false; // -> <</p> <p>/ Script> <script language = "java script"> <! - / ** * Edit Table Function * Click a cell to freely edit the content inside * @para TableID as the Table ID * you want to edit * @para noediid is a TD ID of the TD, such as Table's title * can be written as <TD ID = "no_editer"> Free Edit Form </ TD> * This TD cannot be edited * / function EditableCell (TableID, NOEDIID) ) {var tdObject = event.srcElement; var tObject = ((tdObject.parentNode) .parentNode) .parentNode; if (tObject.id == tableId && tdObject.id = noEdiId && editer_table_cell_tag == false && run_edit_flag == true) {tdObject!. innerHTML = "<input type = text id = edit_table_txt name = edit_table_txt value =" tdObject.innerText "size = '15 'onKeyDown =' enterToTab () '> <input type = button value =' OK 'οnclick =' certainEdit ( ) '> "; Edit_table_txt.focus (); edit_table_txt.select (); editer_table_cell_tag = true; // Modify button Tips EDITTIP.INNERTEXT =" Please determine the button first to confirm the modification! ";} Else {returnaf false;}}}</p> <p>/ ** * determining a modified * / function certainEdit () {var bObject = event.srcElement; var tdObject = bObject.parentNode; var txtObject = tdObject.firstChild; tdObject.innerHTML = txtObject.value; // editer_table_cell_tag representative of the edit box has been closed = false; // Modify button prompt information editip.innertext = "Please click on a cell to edit!";</p> <p>Function Entertainment Entertainment (Event.Srcelement.Type! = 'Button' && Event.Srcelement.Type! = 'Textarea' && Event.Keycode == 13) {Event.KeyCode = 9;}}</p> <p>/ ** * Control whether to edit * / function editstart () {if (event.srcelement.value == "Start Editing") {Event.Srcelement.Value = "Edit"; Run_Edit_Flag = true;} else {// If There is currently no editing box, then the editor is successful, otherwise, if you cannot submit / / must press the OK button to submit the IF (Editer_Table_cell_tag == false) {Alert ("Edit success!"); Event.srcelement.value = "Start Editing "; Run_EDit_flag = false;}}}</p> <p>/ ** * Provides different prompt information * / function showtip () {if (Event.Srcelement.Value == "editing") {edittip.style.top = event.y 15; edittip.style left = event.x 12; edittip.style.visibility = "visible";} else {edittip.style.visibility = "hidden";}} -> </ script> <Table ID = "Editer_Table" width = "100%" align = "οnclick =" editertablecell ('editer_table', 'no_editer')> <trilas = "trhead"> <td colspan = "3" align = "center" id = "no_editer"> Free Edit Form </ TD> </ TD> <33%> Click the Start Edit button, then click End Edit </ TD> <TD Width = "33%> 2 < / TD> <TD width = "33%"> 3 <TD> </ tr> <tr> <td width = "33%"> 4 </ td> <td width = "33%> 5 </ TD> <TD Width = "33%"> 6 </ TD> </ tr> <tr> <td width = "33%> One </ td> <td width =" 33%> TW </ TD > <Td width = "33%> Three </ td> </ tr> <tr> <td width =" 33%> flar </ td> <td width = "33%> FIVE </ TD> <Td width = "33%"> Six </ TD> </ tr> <tr class = "trfoot"> <td color = "3" align = "center" id = "no_editer"> <input type = "Button "Class =" BT "value =" Start Editing "OnClick =" editstart () "OnMouseOver =" showtip () "onM" ONM Ousemove = "showtip ()" onmouseout = "edittip.style.visibility =</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-123173.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="123173" 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.041</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 = 'VepLlbGoqtqew12v9b66t5wab7F6WXSEGenJyIh3GzXPj8W2QfUFj0ScIE7BWCyNy1ZlDXMJoVG9t5Z_2FTUUU9Q_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>