Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How draw rectangle in javascript ?

Status
Not open for further replies.

JackTheRussel

Programmer
Aug 22, 2006
110
FI
Hi.

I noticed an example where you can give parameters:
(w,y,width,height) and when you press the button it draw rectangle into screen.

I don't have experience on javascript so could some show me an example how I can draw an rectangle into screen ?

I don't need any buttons, just simple example which draw an rectangle ?

I would be very pleased.

I have tried to do something like this, but it's not working:

Code:
<html>
<body>

<script type="text/javascript">
var jg = new jsGraphics();

jg.drawRect(30, 35, 10, 10);
</script>

<p>
This draws an rectangle
</p>


</body>
</html>
 
Javascript has no built in graphics library. If you've seen someone's code that looks like this: var jg = new jsGraphics();, then it means that they've likely imported a custom graphics library with custom graphics objects. I wouldn't know where to tell you to look (besides google) to download one of these libraries, because I've never needed to use one for myself, sorry....



-kaht

Looking for a puppy? [small](Silky Terriers are hypoallergenic dogs that make great indoor pets due to their lack of shedding and small size)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top