Category Archives: Javascript css html

JavaScript examples

383 views

JS get window url javascript window location href

window.location.href Example for debuging of code if (window.location.href.indexOf(’/localhost’)!= -1){ // debug code here   }

Posted in Javascript css html | Tagged , | Comments Off on JS get window url javascript window location href
469 views

JS multi threading thread javascript example

For all browsers e.g. old IE 11 ….   <script>       var mbThreadOneRunning = false; var mbThreadOneEnded = false;   var mbThreadTwoRunning = false; var mbThreadTwoEnded = false;   // you can create more than one Thread // … Continue reading

Posted in Javascript css html | Tagged , | Comments Off on JS multi threading thread javascript example
530 views

JS how to emulate click on element javascript example

  <input type="radio" name="nmRadio" id="idOne" onclick="javascript:myFc(this)">One<br> <input type="radio" name="nmRadio" id="idTwo" onclick="javascript:myFc(this)">Two<br> <input type="radio" name="nmRadio" id="idThree" onclick="javascript:myFc(this)">Three<br>   <script> if (!document.all && document.getElementById) document.getElementById(‘idTwo’).click();   function myFc(ts) { alert(ts.id); }   </script>

Posted in Javascript css html | Tagged | Comments Off on JS how to emulate click on element javascript example
548 views

JS multitype multi type array javascript

<div id="idMyDiv"></div> <div id="idOtherDiv"></div>   <script> var myDiv = document.getElementById(’idMyDiv’); var otherDiv = document.getElementById(’idOtherDiv’); // array can contains string, number, object etc. var arr = new Array(’5′, 3, ‘hello’, 12, myDiv);   if (contains(arr, myDiv)) { alert(’Contains myDiv’); idMyDiv.innerHTML = … Continue reading

Posted in Javascript css html | Tagged , | Comments Off on JS multitype multi type array javascript
550 views

JS Check if an array contains an value or object JavaScript

Tthis code works in all previous versions of browsers // use === function contains(arr, valueOrObject) { for (var i = 0; i < arr.length; i++) { if (arr[i] === valueOrObject) { return true; } } return false; }   // … Continue reading

Posted in Javascript css html | Tagged | Comments Off on JS Check if an array contains an value or object JavaScript
571 views

JS sleep wait function javascript use setTimeout

Tthis code works in all previous versions of browsers Pause code by alert var n = 1; alert(n);   n = 5; alert(n); Set timeout var n = 5; // wait 5 second / do next code // next code … Continue reading

Posted in Javascript css html | Tagged , | Comments Off on JS sleep wait function javascript use setTimeout
626 views

JS get type of variable javascript

var n = 0.87; var sType = typeof n; //number   var str = "Hello Sapce!"; sType = typeof str; //string   typeof true === ‘boolean'; typeof undefined === ‘undefined';   typeof function() {} === ‘function'; // etc. …….   … Continue reading

Posted in Javascript css html | Tagged | Comments Off on JS get type of variable javascript
626 views

JS check if variable or function exist javascript

Use typeof // var nMyVariable = 0; // try comment and uncomment this row   if(typeof nMyVariable === ‘undefined’ ){ alert("Variable not exist"); }ele{ alert("Variable exist"); }   ////////////////////////// // chcek if function exist function myFunciton (){ alert("Hello Space!"); } … Continue reading

Posted in Javascript css html | Tagged | Comments Off on JS check if variable or function exist javascript
964 views

CSS circle style html

create div with class with name e.g. circle create in styleSheet.css class circle html code <div class="circle" id="">3</div> css code .circle { border-radius: 50%; width: 50px; height: 50px; background: yellow; position: absolute; display: block; border: 6px solid blue; font-size: 50px; … Continue reading

Posted in Javascript css html | Tagged | Comments Off on CSS circle style html
1,657 views

Links too close together Mobile friendly page

Try set bigger line-height of links and font size for example: /*in css*/ .links{ line-height: 48px; font-size: 20px; background-color: rgb(255,204,0); }   /* in html page set class of link*/ <a class="links" href="m.mydomen.com/mypage.html">Blah blah mypage</a>   // or in css … Continue reading

Posted in Android Examples Code, Javascript css html | Tagged , | Comments Off on Links too close together Mobile friendly page