Proicons, I can't reproduce the erase problem. Are you sure you have not clicked on "Clear canvas" button? Traces are known issue, can't solve it at the moment.
Hawkee, thanks. Sure, here's the demo URL: http://re.trotoys.com/rocanvas/rocanvas.html
There are two boards on that page with the JS code shown.
This is a javascript class that converts the HTML 5 Canvas element into interactive drawing board with tools etc. The code below contains the full class, but I recommend downloading the zip from http://re.trotoys.com/article/rocanvas/ because it contains CSS, images and samples. The code is Apache licensed so you can use it on your sites without any issues.
This is rather simple stuff yet I see it so rarely used. In any dating sites, health calculators, DIY stuff calculators etc they ask you to enter weight and height of something (or your own weight and height) only in their preferred measurement system (metric or Imperial). Boring! This simple javascript will convert the units and instantly fill the appropriate fields in the form.
Below is how the class can be used to make a HTML table with a calendar:
<?php
$_calendar = new Calendar();
$num_weeks=$_calendar->num_weeks(8, 2012); // August 2012
?>
Mon | Tue | Wed | Thu | Fri | Sat | Sun |
---|---|---|---|---|---|---|
<?=$day?$day:" "?> |
That's it. Obviously you can dynamically load month and year to show a dynamic calendar. I use this code in one of my scripts, just not ready to release the full script yet, that's why posting the snippet. The snippet is universal and can be used for any kind of calendar. I will be super-happy if someone can suggest good way to add configurable options for first day of the week etc.