Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 72358

Why is my dynamically-generated oval becoming a square?

$
0
0

Thought i had everything looking ok.

https://docs.oracle.com/javase/7/docs/api/java/awt/Graphics.html

function doit() {
 drawOval(100, 150, 90, 90);
 myOval = document.getElementById("newdiv");
} 

function drawOval(left, top, width, height) {
 if (document.createElement) {
   newdiv=document.createElement("div");
   newdiv.style.position="absolute";
   newdiv.style.left = left+"px";
   newdiv.style.top  = top+"px";
   newdiv.style.width = width+"px";
   newdiv.style.height = height+"px";
   newdiv.style.backgroundColor = 'red';
   newdiv.style.visibility = 'visible';
   newdiv.id = 'newdiv';
   document.body.appendChild(newdiv);
   }
 }
<input type="button" onClick="doit()" value="Do it">

Any ideas?


Viewing all articles
Browse latest Browse all 72358

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>