jquery - I'm trying to add a small javascript piece to a web page, but it just displays the code on the page -


like title says, i'm trying add small javascript piece web page, keeps glitching , shows code, can help?

(for want know, here's javascript piece):

var draw = function() { background(0,0,0); strokeweight(10); stroke(0,255,0); ellipse(mousex,mousey,350,350);    strokeweight(5);    fill(0,0,0);    stroke(0,255,0);    ellipse(mousex,mousey,300,300);    strokeweight(1); stroke(0,255, 0); fill(0,0,0); ellipse(mousex,mousey,250,250); ellipse(mousex,mousey,155,155); ellipse(mousex,mousey,145,145); ellipse(mousex,mousey,135,135); ellipse(mousex,mousey,125,125); ellipse(mousex,mousey,115,115); ellipse(mousex,mousey,105,105); ellipse(mousex,mousey,95,95); ellipse(mousex,mousey,85,85); ellipse(mousex,mousey,75,75); ellipse(mousex,mousey,65,65); ellipse(mousex,mousey,55,55); ellipse(mousex,mousey,45,45); ellipse(mousex,mousey,35,35); ellipse(mousex,mousey,25,25); ellipse(mousex,mousey,15,15); ellipse(mousex,mousey,5,5); line(200,0,mousex,mousey-150); line(0,200,mousex-150,mousey); line(400,200,mousex+150,mousey); line(200,400,mousex,mousey+150); fill(0,0,0); line(0,0,mousex,mousey); line(400,0,mousex,mousey); line(0,400,mousex,mousey); line(400,400,mousex,mousey); fill(0,0,0); stroke(0,255,0);         line(250,250,250,150);     line(250,150,150,150);     line(150,150,150,250);     line(150,250,250,250); ellipse(250,250,10,10); ellipse(250,150,10,10); ellipse(150,150,10,10); ellipse(150,250,10,10);  }; 

anytime have javascript on page must wrap <script></script> tags. try adding page instead.

<script>  var draw = function() {     background(0,0,0);     strokeweight(10);     stroke(0,255,0);     ellipse(mousex,mousey,350,350);     strokeweight(5);     fill(0,0,0);     stroke(0,255,0);     ellipse(mousex,mousey,300,300);     strokeweight(1);     stroke(0,255, 0);     fill(0,0,0);     ellipse(mousex,mousey,250,250);     ellipse(mousex,mousey,155,155);     ellipse(mousex,mousey,145,145);     ellipse(mousex,mousey,135,135);     ellipse(mousex,mousey,125,125);     ellipse(mousex,mousey,115,115);     ellipse(mousex,mousey,105,105);     ellipse(mousex,mousey,95,95);     ellipse(mousex,mousey,85,85);     ellipse(mousex,mousey,75,75);     ellipse(mousex,mousey,65,65);     ellipse(mousex,mousey,55,55);     ellipse(mousex,mousey,45,45);     ellipse(mousex,mousey,35,35);     ellipse(mousex,mousey,25,25);     ellipse(mousex,mousey,15,15);     ellipse(mousex,mousey,5,5);     line(200,0,mousex,mousey-150);     line(0,200,mousex-150,mousey);     line(400,200,mousex+150,mousey);     line(200,400,mousex,mousey+150);     fill(0,0,0);     line(0,0,mousex,mousey);     line(400,0,mousex,mousey);     line(0,400,mousex,mousey);     line(400,400,mousex,mousey);     fill(0,0,0);     stroke(0,255,0);         line(250,250,250,150);     line(250,150,150,150);     line(150,150,150,250);     line(150,250,250,250);     ellipse(250,250,10,10);     ellipse(250,150,10,10);     ellipse(150,150,10,10);     ellipse(150,250,10,10); };  </script> 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -