JavaScript creation progress bar

zhaozj2021-02-17  50

JavaScript Production Progress Bar This article will detail the application of two types of schedules to apply JavaScript and package core code. Put in percent.js

/ ** * Draw a simple percentage progress bar * Barid progress bar span ID * Fpercent completed percentage * STRCAPTION Title * Iheight Height * IUNIT Minimum unit * BGColor Background Color * Border Border Style * Cursor Cursor Style * / Function Simplepercent (Barid, Fpercent, Strcaption, Iheight, IUNIT, BGCOLOR, BORDER, CURSOR) {var PBAR = Document.all (Barid); if (PBAR) {PBAR.TITLE = STRCAPTION FPERCENT "%"; PBAR.INNERHTML = ""; if (BGCOLOR) {PBAR.Style.BackgroundColor = BGCOLOR;} if (border == null) {border = "1px solid # 000000";} PBAR.Style.Border = Border; if (cursor == null) {cursor = " PBAR.Style.cursor = CURSOR;

IHEIGHT == NULL || IHEIGHT <1) {Iheight = 1;} PBAR.Style.Height = IHEIGHT "PX"; if (IUnit == Null || IUnit <1) {iUnit = 1;} PBAR. Style.Width = (IUNIT * 100) "PX"; PBAR.INSERTADJACENTHTML ("Beforeend", " ");

}} Example: Drawing simple percentage progress bar </ title> </ head> <body></p> <p><span id = "_ percentbar"> </ span></p> <p><script language = "javaScript" type = "text / javascript" src = "percent.js"></p> <p></ script> <script language = "javascript" type = "text / javascript"> Simplepercent ("_ percentbar", 77, "installation progress", 10, 5); </ script> </ body> </ html></p> <p>/ ** * percentage progress * / var _hex = array ("00", "01", "02", "03", "04", "05", "06", "07", "08", " 09 "," 0A "," 0b "," 0c "," 0d "," 0e "," 0f "," 10 "," 11 "," 12 "," 13 "," 14 "," 15 " "16", "17", "18", "19", "1a", "1b", "1d", "1e", "1f", "20", "21", " 22 "," 23 "," 24 "," 25 "," 26 "," 27 "," 2B "," 2C "," 2D "," 2E " "2f", "30", "31", "32", "33", "37", "38", "39", "3A", " 3b "," 3C "," 3D "," 3e "," 3F "," 40 "," 41 "," 42 "," 43 "," 44 "," 45 "," 46 "," 47 " "48", "49", "4a", "4b", "4c", "4D", "4E", "4F", "50", "51", "52", "53", " 54 "," 55 "," 56 "," 57 "," 58 "," 59 "," 5A "," 5B "," 5C "," 5D "," 5E "," 5F "," 60 " "61", "62", "63", "64", "65", "66", "6A", "6B", "6C", " 6D "," 6E "," 6F "," 70 "," 71 "," 72 "," 73 "," 74 "," 75 "," 76 "," 77 "," 78 "," 79 " "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83"</p> <p>"84", "85", "86", "87", "88", "89", "8A", "8b", "8C", "8D", "8E", "8F", " 90 "," 91 "," 92 "," 93 "," 94 "," 95 "," 96 "," 97 "," 98 "," 99 "," 9A "," 9B "," 9C " "9D", "9e", "9f", "A0", "A1", "A5", "A6", "A7", "A8", " A9, "AA", "AB", "AC", "AD", "AE", "AF", "B0", "B1", "B2", "B3", "B4", "B5" "B6", "B7", "B8", "B9", "BA", "BB", "BC", "BD", "BE", "BF", "C0", "C1", " C2 "," C3 "," C4 "," C5 "," C6 "," C7 "," CB "," CC "," CD "," CE " "CF", "D0", "D1", "D2", "D3", "D7", "D8", "D8", "D9", "Da", " DB "," DC "," DD "," DE "," DF "," E0 "," E1 "," E2 "," E3 "," E4 "," E5 "," E6 "," E7 " "E8", "E9", "EA", "EB", "EC", "EE", "EF", "F0", "F1", "F2", "F3", " F4 "," F5 "," F6 "," F7 "," F8 "," F9 "," FA "," FB "," FC "," FD "," FE "," FF ");</p> <p>/ ** * Draw a gradient percentage progress bar * Barid progress bar span ID * Fpercent completed percentage * strcaption title * BDOUBLE 100 or 200 Unit * IUnit minimum unit * BGColor background color * Border Border style * Cursor cursor style * / function Paintpercent (BARID, FPERCENT, STRCAPTION, BDOUBLE, IHEIGHT, IUNIT, BDOUBLE, BORDER, CURSOR) {var PBAR = Document.all (barid); if (PBAR) {PBAR.TITLE = STRCAPTION FPERCENT "%"; PBAR.INNERHTML = ""; If (bgcolor) {PBAR.Style.BackgroundColor = BGCOLOR;} if (border == null) {border = "1px solid # 000000";} PBAR.Style.Border = border; if (Cursor == Null ) {CurSor = "default";} PBAR.Style.cursor = Cursor; if (Iheight == null || Iheight <1) {iHEIGHT = 1;} PBAR.Style.Height = IHEIGHT "PX"; if (IUnit) == NULL || IUNIT <1) {iUnit = 1;}}} {bdouble = 2;} else {bdouble = 1;}</p> <p>PBAR.Style.Width = (iUnit * bdouble * 100) "px"; PBAR.Style.Whitespace = "nowrap";</p> <p>For (VAR IDX = 0; IDX <BDOUBLE * 100; IDX ) {IF (IDX <fpercent * bdouble) {PBAR.INSERTADJACENTHTML ("BeforeEnd", "<span style = 'width:" iUnit "PX; Height : " Iheight " PX; Background-Color: # 00 " _ HEX [256-IdX] " FF; '> </ span> ");} else {PBAR.InsertAdjacenthtml (" BeforeEnd "," <span style = 'Width: " IUnit " PX; Height: " IHEIGHT " PX'> </ span> ");}}}} instance: <html> <head> <title> Draw a gradient percentage progress bar </ title> < / head> <body></p> <p><Table> <Tr> <TD> <span id = "_ percentbar"> </ span> </ td> </ tr> </ table> <script language = "javascript" type = "text / javascript" src = " Percent.js "></p> <p></ script> <script language = "javascript" type = "text / javascript"> PainTpercent ("_ percentbar", 89, "installation progress", true, 18); </ script> </ body> </ html></p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-29334.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="29334" 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.038</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 = '8rYHp6wv7UJLE_2F9E6bgt2c8BgFYRQhtN5mOzt6J01oiKl86sO0DgvDZx7FH_2FYsITPgD8ebw5tLQqOa2fccXAXA_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>