We help IT Professionals succeed at work.

How to script Canvas?

374 Views
Last Modified: 2014-08-28
scripting help needed for this specific URL: http://jsfiddle.net/ezanker/4hfkb/6/

Simply, I am trying to script a clearCanvas drawing feature via a clearRect function. Can anyone let me know how to do this?

What I think are the snippets needed to script this are as follows, but I do not know how the JavaScript area gets resolved within the web page in order to clear Canvas1:

HTML:
<a href="#canvas1">clearCanvas</a>


JavaScript:
function clearCanvas() {            
            context.clearRect(0, 0, canvas.width, canvas.height);
        }

Any scripting solution that properly "runs" on the JSFIDDLE site - and clears the drawing on the Canvas area - would be greatly appreciated. Thank you!
Comment
Watch Question

Software Engineer
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.