473,666 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Drawing circuit in Javascript

2 New Member
Am new to javaScript.
Am trying to draw circuits in JavaScript.
I have problem with drawing the arcs in the AND & OR logic gates

Can any body help me to do this?
Am using IE6.0. it's not supporting canvas.
fillArc() method of JavaScript is also not working.
Expand|Select|Wrap|Line Numbers
  1.  
  2. <HTML>
  3. <head>
  4. <script type="text/javascript" src="wz_jsgraphics.js"></script> 
  5.  
  6. </head>
  7. <body> 
  8.  
  9. <div id="first"></div>
  10. <script type="text/javascript">
  11. function d()
  12. {
  13. a.drawLine(105,120,105,400);// LINE FOR A
  14. a.drawString("A'",120,100); 
  15. a.drawLine(105,130,125,130);//LINE CONNECTING A AND A'
  16. a.drawLine(125,130,125,140);// LINE from A' PROCEEDING TO NOT GATE
  17. a.drawLine(115,140,135,140);// STRAIGHT LINE PART OF NOT GATE
  18. a.drawLine(115,140,125,150);//LEFT LINE OF NOT
  19. a.drawLine(125,150,135,140);// RIGHT LINE OF NOT
  20. a.drawEllipse(120,150,10,10);
  21. a.drawLine(125,160,125,400); // LINE FOR A'
  22. a.drawString("B",160,100);
  23. a.drawLine(165,120,165,400);// LINE FOR B
  24. a.drawString("B'",180,100); 
  25. a.drawLine(165,130,185,130);//LINE CONNECTING B AND B'
  26. a.drawLine(185,130,185,140);// LINE from B' PROCEEDING TO NOT GATE
  27. a.drawLine(175,140,195,140);// STRAIGHT LINE PART OF NOT GATE
  28. a.drawLine(175,140,185,150);//LEFT LINE OF NOT
  29. a.drawLine(185,150,195,140);// RIGHT LINE OF NOT
  30. a.drawEllipse(180,150,10,10);
  31. a.drawLine(185,160,185,400); // LINE FOR B'
  32. a.drawLine(105,170,230,170);//line extending from A for AB
  33. a.fillEllipse(104,169,4,4);//point denoting A in AB(and gate)
  34. a.drawLine(165,190,230,190);//line extending from B for AB
  35. a.fillEllipse(164,189,4,4);//point denoting B in AB(AND gate)
  36. a.drawLine(230,165,230,195);//line joining A and B in AND gate
  37. //a.fillArc(230,165,30,30,0,60);
  38. a.drawRect(230,165,30,30);
  39. var Xpoints = new Array(10,30,20,10);
  40. var YPoints = new Array(10,10,20,10);
  41. a.drawPolyline(Xpoints,YPoints);
  42. var Xpoints1 = new Array(300,320,310,300);
  43. var YPoints1 = new Array(300,300,310,300);
  44. a.drawPolyline(Xpoints1,YPoints1);
  45. var a1=500;
  46. var b1=500;
  47. var c,d=0;
  48. /*for(c=1;c<=20;c++)
  49. {
  50. a.drawEllipse(a1,b1,1,1);
  51. if (c<10)
  52. {
  53. a1=a1+5;
  54. b1=b1+5;
  55. }
  56. if(c==10)
  57. {
  58. if(d<=8))
  59. {
  60. a1=a1-1;
  61. b1=b1;
  62. d=d+1;
  63. }
  64. }
  65. else
  66. {
  67. a1=a1-1;
  68. b1=b1+1;
  69. }
  70. c=c+1;
  71. }*/
  72. a.paint();
  73. }
  74. var a=new jsGraphics();
  75. var b=new jsGraphics("first");
  76. d();
  77. </script>
  78. </body>
  79. </html>
  80.  
Thanking u in anticipation
Maha
Oct 6 '08 #1
3 3435
acoder
16,027 Recognized Expert Moderator MVP
Have you tested in other browsers?

Is it just the arcs that you can't get working?
Oct 6 '08 #2
mahasarathi
2 New Member
NO i just tried in IE6.0.
This is for my examination sake. My college lab computers have only IE6.0. Hence am forced to do in IE6.0

If there is no such restriction, then I can use any other browser such as opera. I tried to use canvas (HTML5). IE6 is not supporting canvas.
Oct 7 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
That is very poor on the part of the college for not offering a choice, not teaching students to program cross-browser, and at the very least not upgrading.

Try the examples on the website where you got the library script from. Do they work in IE6?
Oct 7 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

15
12998
by: Remon Huijts | last post by:
Hi there, For a very specific service, I have created a PHP script that uses the GD library functions to create a PNG image from a few lines of XML data describing a simple diagram/drawing. It's cool and works, writing the XML data in a text editor is straightforward for me because I designed the format. I have no idea however how I can make a simple online drawing program that creates this XML code. The code is realy simple, just...
8
48024
by: Stefan Burger | last post by:
Those of you who are in need for drawing vector lines might be interested in the following code. DrawLine( x1, y1, x2, y2, color ) draws a vector line from any Point x1,y1 to any Point x2,y2 in any color (string format #RRGGBB) by using div-tags. regards Stefan ###############code starts here#########################
2
5366
by: Mike Edwards | last post by:
I need to use javascript's graphics API to draw the letters of the alphabet. If necessary, I can map out all 26 letters myself and use drawline() to draw them, but I am hoping someone out there might have a better suggestion. The user will click a spot on the canvas, and the script will draw one of the letters at that spot. thanks, mike
2
4119
by: webposter | last post by:
Hi, I am looking for information on a data structure (and associated algorithm) to do short-circuit evaluation of boolean expressions and haven't found a single one even after googing for two days! Can anyone point me to good resources (or implementations) that do this. Basically is there any way to optimize a boolean expression expressed in RPN (reverse polish notation)? I want to implement the algorithm/data structure in C. If you...
0
1536
by: rakesh.Mysore | last post by:
hi Currently am working on project which have graphical editor for circuit diagram which involve validation of circuit and logic flow in circuit diagram.(process diagram from left to right). please let me know any algorithum avialiable for above process. thanks Rakesh
0
1324
by: pranesh.nayak | last post by:
Currently am working on project which has graphical editor for circuit diagram which involve validation of circuit and logic flow in circuit diagram.(process diagram from left to right). please let me know any algorithm avialiable for above process.
1
3311
by: luna18 | last post by:
i like to do programming but i am not a computer student.. =) i m trying to write a program to determine a euler circuit.but end up all stuck... i tyr to take the input as graph and if it is a euler circuit it will output an euler circuit. can any1 give me some starting point or hints ? thanks for viewing...
15
4021
by: javelin | last post by:
I need to be able to create a javascript based drawing/signature box, and be able to save it. Can someone refer me to a script that will allow this, or even a 3rd party package for sale? It can't be Java or ActiveX. Thank you.
7
2139
by: serave | last post by:
Hi i'm new in this group. I need some help with php. I need to draw any mathematical function i get through a form? Please help me
0
8443
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6192
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2769
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.