//-------------------------------------------------------------------------- // CHOREOGRAPHIC CODE by Joana Chicau //-------------------------------------------------------------------------- // errors we live by // trial and error // margin of error // https://upload.wikimedia.org/wikipedia/commons/a/a9/Empirical_Rule.PNG // printing error messages; // creating a loop for changing text in all headings // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status var delay="1"; var count='0'; var tempo="500"; var elements = document.getElementsByTagName("a") var textarray = [ "ヽ(´∇´)ノ (∇´ノ) ヽ( )ノ (ヽ´∇) ヽ(´∇`)ノ \ (^_^ ) ノ", "(。・・。) 401 Unauthorized", " 402 Payment Required 💸 💱 (゜゜)", " (゚ρ゚; 403 Forbidden", " 404 Not Found ヾ(´・ ・`。)ノ” ", " 406 Not Acceptable ⊙ ﹏ ⊙", " what error? ʍɥɐʇ ǝɹɹoɹ¿ what error? ʍɥɐʇ ǝɹɹoɹ¿", " 408 Request Timeout ☼☼¸.•*", "(─‿─) (─‿‿─) (─‿─) (─‿‿─) 409 Conflict (─‿─) (─‿‿─) (─‿─) (─‿‿─)", "ˏ 𓏧 𓏲 𓏲 𓏲 𓋒 410 Gone 𓏲 𓏲 𓏲 𓏲 𓏧 ˎ", "415 Unsupported Media Type (◔_◔)", " ━━━━━━━ 416 Range ▼△▼△▼△▼ Not ▼△▼△▼△▼ Satisfiable ━━━━━━━ ", " 417 Expectation ٩( ∩_∩ )۶ Failed (¸.꒳.¸) ", " 418 I'm a teapot ☕ the server refuses the attempt to brew coffee with a teapot.", "425 ⏰ ⌛ ⏱️ Too Early ⏱️ ⌛ ⏰ ・.⋆。⋆☂˚。⋆。˚☽˚。⋆", "【☆】★【☆】★【426 Upgrade Required】★【☆】★【☆】", "。°。°。°。°。°。°。°。°。°。°。° 429 Too Many Requests 。°。°。°。°。°。°。°。°。°。°。°", "⤹⋆⸙͎۪۫。˚۰˚ 451 Unavailable For Legal Reasons˚⁀➷。˚⸙͎۪۫⋆ ༄ ", "■ □ ■ □ ■ □ ■ □ 502 Bad Gateway ■ □ ■ □ ■ □ ■", "‿︵‿︵‿︵‿ 508 Loop Detected ︵‿︵‿︵‿︵", "○ꊞ○ꊞ○ꊞ○ꊞ○ꊞ 507 Insufficient Storage ꊞ○ꊞ○ꊞ○ꊞ○ꊞ○", " 100 Continue ♪ ● ☽ ♩ ○ ♬ ☆ ༝̩̩̥͙ ", "٩(✿∂‿∂✿)۶ 200 OK ✿ ✿ ✿ ✿ ✿ " ]; //textarray.push(" ♪ ♪ ♪ ┌(・ 。・)┘ ♩♪ ♫ ♬"); function wonder02() { var rannum= Math.floor(Math.random()*textarray.length); for (var i = 0; i < elements.length; i++) { elements[i].innerHTML = textarray[rannum]; } timer = setTimeout("wonder()", delay*tempo); } // clearTimeout(timer); function wonder() { document.querySelector('#stage02').innerHTML = textarray[count]; count++; if(count==textarray.length){count='0';} setTimeout("wonder()",6000); } wonder() // - - - - - - - - INPUT Errors - - - - - - - - //
Please input a number between 5 and 10:
// // // function myFunction() { const message = document.getElementById("p01"); message.innerHTML = ""; let x = document.getElementById("demo").value; try { if(x == "") throw "empty"; if(isNaN(x)) throw "not a number"; x = Number(x); if(x < 5) throw "too low"; if(x > 10) throw "too high"; } catch(err) { message.innerHTML = "Input is " + err; } } // - - - - - - - - JavaScript Errors - - - - - - - - $(document).ready(function(){ if (typeof console != "undefined") if (typeof console.log != 'undefined') console.olog = console.log; else console.olog = function() {}; console.log = function(message) { console.olog(message); $('#err').append(message); // $('#err').append('' + message + ''); }; console.error = console.debug = console.info = console.log }); window.onerror = function (msg, url, lineNo, columnNo, error) { var string = msg.toLowerCase(); var substring = 'script error'; if (string.indexOf(substring) > -1){ alert('Script Error: See Browser Console for Detail'); } else { var message = [ 'Message: ' + msg, 'URL: ' + url, 'Line: ' + lineNo, 'Column: ' + columnNo, 'Error object: ' + JSON.stringify(error) ].join(' - '); alert(message); console.log(message); } return false; }; /* let num = 1; a = y + 1; let ran = 1; try { // Type Error num.toUpperCase(); // Reference Error a = y + 1; // Syntax Error eval("alert('Hello)"); // Range Error ran.toPrecision(500); } catch (error) { switch (true) { case (error instanceof ForbiddenError): { document.getElementById("err").innerHTML = error.name + "