Drag and drop table content with JavaScript

With few lines of JavaScript, you can drag and drop table content. Content of the HTML table cells can be dragged to the another table cell or another table. It isn't so difficult to define onMouseMove event and change top / left element styles to move the object. In case with table, you will have to determine destination table cell. Attaching onMouseOver handler to the table cells will not help, because browser will not fire events to the elements beneath the dragged object.

Yum install mplayer on Fedora

After upgrade to the Fedora Core 10, I was surprised when "yum install mplayer" didn't find any package. I'm sure yum worked in Fedora Core 9 with installed Livna repository. I checked my Livna configuration once again, but there was no luck with mplayer. Something has definitely changed in the meantime.

AJAX progress bar

With few lines of JavaScript and CSS you can make simple AJAX progress bar. JavaScript will periodically ask for progress value and server will respond with XML. Progress value should be extracted from the XML and displayed as width of the DIV element.

Adding table rows & columns in JavaScript

With insertRow() method you can insert a new row at the specified position in HTML table. After row is created, use insertCell() method to insert a table cell. Wrap this methods in JavaScript functions and you have code to dynamically add new rows and columns in the HTML table.

Write to a log file with PHP

As you certainly know, PHP can be used for command line scripting too. In my case, I caught myself writing log PHP function many times so I finally decided to write Logging PHP class. After Logging class initialization, first call of lwrite method will open log file for writing. Log file will be closed implicitly when PHP script ends.

Drawing with JavaScript

This post shows how to implement simple JavaScript drawing. After page is loaded, JavaScript will generate HTML table and attach onMouseDown and onMouseOver event handlers to the each table cell. When user clicks the left mouse button and move mouse pointer over table cell, table cell will change background-color property.

Clear form with JavaScript

JavaScript is the only option, if you want to have the ability to clear all form fields. Yes, HTML form has Reset method, but if the form has initial values, then Reset will return the form to the initial state instead of clear input fields. In this post you will find clearForms JavaScript function and live demo.