473,385 Members | 1,846 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,385 software developers and data experts.

Drawing circuit in Javascript

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 3422
acoder
16,027 Expert Mod 8TB
Have you tested in other browsers?

Is it just the arcs that you can't get working?
Oct 6 '08 #2
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 Expert Mod 8TB
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
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...
8
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...
2
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...
2
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...
0
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). ...
0
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...
1
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...
15
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...
7
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
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...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.