Go Back   MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 9, 2013, 01:43 AM   #1
happynnc
macrumors newbie
 
Join Date: Mar 2013
HTML5 canvas

Hello,

Could you please help me with my code

At the beginning: I insert an image into table and view in browser >> I found that there are a line under this iamage then I use allign="middle" and I work.

But when I draw a canvas, i cannot put allign = "middle" into the script to remove the line under image. Could you help me please?

<!doctype html>
<html>


<head>
<link rel="stylesheet" href="Text-CSS/main.css">

<script>
function init() {
setImageOne();
}

function setImageOne() { setImage('Images/Home_Icon.jpg'); }

function setImageTwo() { setImage('Images/Home_Icon_Over.jpg'); }

function setImage(src) {
var canvas = document.getElementById("e");
var context = canvas.getContext("2d");
if (context == null) return;
var img = new Image();
img.src = src;
context.drawImage(img, 0, 0, 35, 44);
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
body {
background-color: #999;
}
</style>
</head>

<body onLoad="init()">
<div>


<table width="100%" border="0" cellspacing="0" cellpadding="0" class="BG_Top_BN">
<tr>
<th scope="col">
<canvas id="e" width="35" height="44" onMouseOver="setImageTwo()" onMouseOut="setImageOne()" align="center">
<p>No Canvas Support in Browser</p>
</canvas>
</th>
</tr>
</table>
</div>
</body>

</html>
happynnc is offline   0 Reply With Quote

Reply
MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
iPad: Switcheasy Canvas joekim1026 iPad Accessories 0 Feb 4, 2013 09:39 PM
iPad: Switcheasy Canvas chidoc iPad Accessories 0 Jan 7, 2013 12:03 PM
My Canvas Maithili iPad Apps 0 Jun 26, 2012 05:52 AM
canvas printing doyle369 Community Discussion 5 Jun 13, 2012 05:02 PM

Forum Jump

All times are GMT -5. The time now is 09:55 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC