Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Sunday, July 31, 2016

Student UiTM Sufo Auto Fill Form

SUFO FORM ONLY!!
Simple javascript
Budak UiTM yang malas nak tekan satu2 form SUFO
Cara2
1. Right Click -> Inspect Element
2. Tekan Console
3. Paste Code dibawah di console anda

for(y=1; y<=24; y++){
    var questionNo = window.frames[0].frames[1].document.getElementsByName('txtanswer'+y);
        questionNo[3].checked=true
}

window.frames[0].frames[1].document.getElementsByName('b2')[0].click();

Saturday, November 7, 2015

How to detect IE in php and Javascript




In PHP

  1. $chrome = 'https://www.google.com/chrome/browser/desktop';
  2. if (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) ||
  3.        (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false) ||
  4.        (strpos($_SERVER['HTTP_USER_AGENT'], "Edge") == true)) {
  5.         header('Location:'.$chrome);
  6. }
  7. else{
  8.     // goto your page
  9. }

In Javascript



  1. // detect IE ersion
  2. var IEversion = detectIE();
  3. if (IEversion !== false) {
  4.     alert('You are using IE'+IEversion);
  5.     document.location.href = "https://www.google.com/chrome/browser/desktop/";
  6. }
  7. function detectIE() {
  8.     var getAgent = window.navigator.userAgent;
  9.     var msie = getAgent.indexOf('MSIE ');
  10.     if (msie > 0) {
  11.         return parseInt(getAgent.substring(msie+5, getAgent.indexOf('.', msie)), 10);
  12.     }
  13.     var trident = getAgent.indexOf('Trident/');
  14.     if (trident > 0) {
  15.         var rv = getAgent.indexOf('rv:');
  16.         return parseInt(getAgent.substring(rv+3, getAgent.indexOf('.', rv)), 10);
  17.     }
  18.     var edge = getAgent.indexOf('Edge/');
  19.     if (edge > 0) {
  20.         return parseInt(getAgent.substring(edge+5, getAgent.indexOf('.', edge)), 10);
  21.     }
  22.     return false;
  23. }

Dynamically change background color randomly

Hexadecimal color values are supported in all major browsers.

A hexadecimal color is specified with: #RRGGBB, where the RR (red), GG (green) and BB (blue) hexadecimal integers specify the components of the color. All values must be between 00 and FF.

For example, the #0000FF value is rendered as blue, because the blue component is set to its highest value (FF) and the others are set to the lowest value (00).

Below is the script how to get randomly color.

Javascript Version

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
var color = "0123456789ABCEDF";

function changeColor() {
    var temp = "";
    for (var a = 0; a < 6; a++)
        temp += color[Math.floor(Math.random() * color.length)];


    document.body.style.backgroundColor = "#" + temp;
}

function start() {
    setInterval("changeColor()", 1000)
}

start();