Tag Archives: show

How to hide and show elements with JavaScript (updated)

webThere are times that we just want to hide an element first, and shows it later when the user performs something like clicking a button.

Implementing this functionality with JavaScript is quite easy. (On a side note, there is a really great section on Embedding JavaScript in HTML in JavaScript: The Definitive Guide: Activate Your Web Pages. If you don’t have that book, you really should.)
The strategy is to place the controlled element on a hidden layer (div), and then change the display attribute to make it show up.

First, Let’s define a variable, which tells if the video should be shown, in JavaScript.
Continue reading

How to post source code on WordPress

The trick is to use the WordPress
[ sourcecode] tag, as documented at http://en.support.wordpress.com/code/posting-source-code/

Note: You have to enclose the [ sourcecode] shortcut tag in square – not pointy – brackets.
Here is a snippets of C code.

The default for wraplines is true, which causes long lines to be wrapped. That isn’t appropriate for Python, so specify Continue reading