473,327 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Javascript graphics

I've been trying out David Betz's sample chapter on doing graphics with
javascript
http://www.davidbetz.net/graphics/

But I can't get the horizontal line to draw. There's no errors in
Firefox's javascript console so I'm not sure what I'm doing wrong. I'm
not even close to javascript expert, though...
<html>
<head>
<title>Horizontal Line Test</title>
<script language="javascript" type="text/javascript">
function DrawHorizontalLine(x, y, l, c, parentObj) {
var longPixel = document.createElement('div');
longPixel.className = 'Ink';

longPixel.style.width = 1 + 'px';

longPixel.style.left = x + 'px';
longPixel.style.top = y + 'px';

longPixel.style.borderTopColor = c;

parentObj.appendChild(longPixel);
}
</script>
</head>
<body>
<div id="dynamicAttacher"></div>
<script language="javascript" type="text/javascript">
var dynamicAttacherObj = document.getElementById('dynamicAttacher');
DrawHorizontalLine( 100, 100, 200, "#000000, dynamicAttacherObj );
</script>
</body>
</html>

May 17 '06 #1
2 1358


Jakanapes wrote:

But I can't get the horizontal line to draw. There's no errors in
Firefox's javascript console so I'm not sure what I'm doing wrong.
DrawHorizontalLine( 100, 100, 200, "#000000, dynamicAttacherObj );

^^^^
That should surely give a syntax error, I guess you want
DrawHorizontalLine( 100, 100, 200, "#000000", dynamicAttacherObj );

--

Martin Honnen
http://JavaScript.FAQTs.com/
May 17 '06 #2
yeah, I saw that after I posted. Fixed it and still don't get a line.

I tried the canvas example lower on the page and I get a canvas border,
but still no horizontal line...

still researching.

May 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: MStepansky | last post by:
Any ideas of some of the good Javascript books that involves graphics programming: - to be able to move the images pixelwisely. - to be able to grab an image and move it around on screen (on...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
9
by: julierbriggs | last post by:
hi, is there a pure javascript code (no Java applets), for painting or drawing using a e-pencil or something, in a defined space on the screen? best regards-(:JB:)
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.