Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- Elements



  Show drop down list or menu above of a flash in webpage

How to make a drop down menu show above of a  flash in webpage?Normally when we embed a flash or swf file into our webpage, it is not one component of our webpage.So sometimes the flash will always show above of the webpage, it will not interact with our HTML page.To solve this problem,we need to use wmode property of object tag.wmode has three properties: window,opaque and transparent.window : the flash will show in its own rectangular window,which will not interact with    ...

   HTML,Flash,Block,Drop down menu,Solution     2012-03-12 17:13:57

  Convert HTML to DOM elements using JavaScript

In some cases, one would want to convert a HTML string to the DOM elements so that JavaScript can handle them easily. This is frequently used when one get some data from third party APIs where the data is in HTML format. In JavaScript, there are a couple of ways one can use to convert HTML to DOM elements. DOMParser document.createElement DOMParser DOMParser can parse XML or HTML source stored in a string into a DOM Document. After the conversion, the normal JavaScript call of h...

   JAVASCRIPT,DOMPARSER,DOCUMENT.CREATEELEMENT,HTML,DOM     2017-08-18 22:51:46

  jQuery to check whether checkbox is checked

In Vanilla JavaScript, the correct way of checking whether a checkbox is checked is to get the property checked of the checkbox. Assuming there is an checkbox with id "checkbox1", below line will return true if the checkbox is checked while it will return false if the checkbox is unchecked: document.getElementById("checkbox1").checked In jQuery, there are a few ways to check this. The first one is to using the corresponding counterpart of the Vanilla JavaScript, it is to check the checked proper...

   jQuery,checked,checkbox,attr,prop     2015-07-25 08:49:54

  You can get properties of pseudo-element using JavaScript now

The pseudo-element6 in CSS is extremely useful, you can use it to create CSS triangles and lots of other elements without overuse many HTML elements. In the past, you cannot get the property value of pseudo-element in CSS using JavaScript. Now you can call a new method in JavaScript to get them easily. Assume you have below CSS codes: .element:before { content: 'NEW'; color: rgb(255, 0, 0); } To get the properties in .element:before, you can use below JavaScript method: var color = window.getC...

   pseudo-element,property,JavaScript     2014-04-05 20:58:25

  Manipulating JavaScript Arrays

Our first tutorial on JavaScript arrays covered the basics: creating arrays, accessing the contents of arrays, array lengths, and looping through arrays. In this tutorial, you explore arrays in more depth, and learn how to use various methods of the Array object to manipulate arrays. Extracting sections of an array with slice() You're not limited to accessing single array elements at a time. Thanks to the slice() method, you can grab a whole section of an array at once. slice() has the follow...

   JavaScript,Array,Manipulate,Join,Splice     2011-08-07 01:56:06

  ConcurrentHashMap vs Collections.synchronizedMap()

ConcurrentHashMap and Collections.synchronizedMap() both provide thread-safe operations of collections of data. They are used in multithreaded programs to provide both thread safety and performance improvements. In many cases, we can use either of them. But the realization of thread safety is different for these two implementations. ConcurrentHashMap will create an HashEntry[] array internally to store the elements passed in from a Map, while Collections.synchronizedMap() will return a Synchroni...

   ConcurrentHashMap,Collections.synchronizedMap     2014-09-18 05:04:59

  Supercolliding a PHP array

Did you know that inserting 2^16 = 65536 specially crafted values into a normal PHP array can take 30 seconds? Normally this would take only 0.01 seconds. This is the code to reproduce it: <?php echo '<pre>'; $size = pow(2, 16); // 16 is just an example, could also be 15 or 17 $startTime = microtime(true); $array = array(); for ($key = 0, $maxKey = ($size - 1) * $size; $key <= $maxKey; $key += $size) { $array[$key] = 0; } $endTime = microtime(true); echo 'Inserting...

   PHP,Array,hashtable,Slow,Colliding     2011-12-29 09:02:01

  Remove duplicated elements in JavaScript array

During interviews, one frequent question asked would be something like how to remove duplicated elements in a JavaScript array and how many different ways you can think of. The interviewee would also be asked to write the code down. In real applications, normally front end would not need to handle this case since normally it would be done by backend, but still it's necessary for front end developers to know different ways of doing this. This post will share some of the common ways to remove dupl...

   JAVASCRIPT,ARRAY,DUPLICATED ELEMENT     2018-09-21 22:32:10

  Some tricks and tips for using for range in GoLang

GoLang provides two major ways to loop through elements of array, slice and map. They are for and for range. Many people find that for range is very convenient when don't care about the index of the element. In this post, some tricks and tips would be talked about regarding for range. 1. Loop and get pointer of each element Assume there is a code snippet like below which is to get the pointer of each element in an array and create a new array with the corresponding pointer. arr := [2]int{1, 2} r...

   POINTER,FOR LOOP,GOLANG,FOR RANGE     2020-03-08 01:07:00

  How ScrollerJS works

ScrollerJS is a light weight number scroller module to be embedded in web apps. It provides fancy number scrolling animations. ScrollerJS supports both CSS transition and DOM animation to handle the animation needed. If CSS transition is supported in a browser, CSS transition will be the preferred option for animation. If in old browsers where CSS transition is not supported. DOM animation will be chosen automatically. How does the number scrolling actually work? To transition a number from 0 to...

   ScrollerJS,JavaScript,CSS,GitHub     2015-06-11 06:54:44