Javascript block of quotes -
var circle; var love = 30; document.getelementbyid("output"). innerhtml=(" circle __ units area of __ <svg version='1.1' width='360' height='300' xmlns='http://www.w3.org/2000/svg'> <circle cx='50%' cy='50%' r='" + love + " %' stroke='black' stroke-width='2' fill='red'/> </svg>"); i know there syntax error in here, , sure has multitude of quotes in block. should make smaller strings , combine them. kind of .= php? (the whole point of block set svg radius{r} variable love.) - josh
edit 2 # (thanks communities support, here nice neat working code)
var love = 30; var va1 = "the circle __ units area of __ "; var va2 =" <svg version='1.1' width='360' height='300' xmlns='http://www.w3.org/2000/svg'>" ; var va3 = " <circle cx='50%' cy='50%' r='" ; var va4 = "%' stroke='black' stroke-width='2' fill='red'/> </svg>"; document.getelementbyid("output"). innerhtml=(va1+ va2 + va3 + love +va4);
use escape symbol \ multi line strings
like this
var circle; var love = 30; document.getelementbyid("output"). innerhtml=(" \ circle __ units area of __ \ <svg version='1.1' \ width='360' height='300' \ xmlns='http://www.w3.org/2000/svg'> \ <circle cx='50%' cy='50%' r='" + love + "%' stroke='black' \ stroke-width='2' fill='red'/> \ </svg>");
Comments
Post a Comment