1 Replies - 2711 Views - Last Post: 21 March 2008 - 05:42 PM

#1 kokito  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 26-February 08

Help with adding a button to erase the drawing window

Post icon  Posted 21 March 2008 - 05:39 PM

My question is : add a button to this program to erase the entire drawing window

the code is:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">



<html xmlns = "http://www.w3.org/1999/xhtml">
        <head>
	<title></title>
	<style type = "text/css">
	#canvas { width: 400px;
		  border: 1px solid #999999; 
		  border-collapse: collapse } 
	td      { width: 4px;
		  height: 4px }
	th.key  { font-family: arial, helvetica, sans-serif;
		  font-size: 12px;
		  border-bottom: 1px solid #999999 }
	
	</style>


	<script type = "text/javascript">
	<!--
	
	function createCanvas ()
	{
		var side = 100;
		var tbody = document.getElementById( "tablebody" );

		for(var i =0; i < side; i++)
		{
			var row = document.createElement( "tr" );
	
			for(var j=0; j < side; j++)
			{
				var cell = document.createElement ( "td");
				cell.onmousemove = processMouseMove;
				row.appendChild( cell );
			}
			tbody.appendChild ( row );
		}
	}
	
	function processMouseMove( e )
	{
		if( !e )
			var e = window.event;
	
		if( e.ctrlKey )
			this.style.backgroundColor = "blue";
		if( e.shiftKey )
			this.style.backgroundColor = "red";
		
	}
</script>



</head>
	<body onload = "createCanvas()">
		<table id = "canvas" class = "canvas"><tbody id = "tablebody">
		<tr><th class = "key" colspan = "100">Hold <tt>ctrl</tt>
		to draw blue. Hold <tt>shift</tt> to draw red. </th></tr>
		</tbody></table>
	</body>
</html>



I appreciate your help.
Thanks a lot.

This post has been edited by PsychoCoder: 21 March 2008 - 05:41 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Help with adding a button to erase the drawing window

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1639
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Help with adding a button to erase the drawing window

Posted 21 March 2008 - 05:42 PM

So, if I understand you, you're wanting someone from here to create this for you? If I'm wrong let me know :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1