Hy every body, what I am making is some functions for other people to make figures with pixels.
So I put two documents:
imagepixel.html

<!doctype html>
<html>
   <head>
      <meta name="author" content="Someone"/>
      <meta name="description" content="my webpage ..."/>
      <meta name="keywords" content="my, webpage"/>
      <title>image by pixel</title>
      <script language="JavaScript" type="text/javascript" src="imagepixel.js"></script>
      <script language="JavaScript" type="text/javascript">
         <!--
         window.onload=function(){		          
            square(document.getElementById("figure"),"rgb(0,0,50)",400,20,70,20,70,1)
         }
         //-->
      </script>
     <title>Untitled</title>
   </head>
   <body>
      <div id="figure"></div>
      ...
   </body>
</html>

imagepixel.js

function pixel(location,color,zoom,px,py,pz)
{
   location.insertAdjacentHTML("beforeBegin","<span style='background-color:"+color+";width:"+zoom+"px;height:"+zoom+"px;font-size:"+zoom+"px;position:absolute;left:"+px*pz+";top:"+py*pz+";z-index:"+pz+"'></span>")
}
function square(squareLocation,squareColor,zoomSquare,xi,xf,yi,yf,z)
{				 
   for(x=xi;x<xf;x+=(zoomSquare/z)){											 
      for(y=yi;y<yf;y+=(zoomSquare/z)){													 										  
         pixel(squareLocation,squareColor,zoomSquare,x,y,z)	
      }												  
   }
}

I want to put a code for triangles like this

function triangle(triangleLocation,triangleColor,triangleZoom,x1,y1,x2,y2,x3,y3)
{
   ...
}

How could I make the triangle function?
you can youse Js, HTML and CSS
don't youse JQuery or Ajax

Recommended Answers

All 2 Replies

This remarkable page http://www.uselesspickles.com/triangles/demo.html describes and illustrates a truly brilliant way to draw triangles with javascript, CSS and HTML. In the course of doing so it briefly mentions the tedious no-brain alternative.

Thanks for your awnser it will help me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.