javascript - align image randomized by function -


this part of code works alright:

var cobras=new array();  cobras[0] = '<img src="cobra1.jpg">'; cobras[1] = '<img src="cobra2.jpg">'; cobras[2] = '<img src="cobra3.jpg">'; cobras[3] = '<img src="cobra4.jpg">'; cobras[4] = '<img src="cobra5.jpg">'; cobras[5] = '<img src="cobra6.jpg">'; cobras[6] = '<img src="cobra7.jpg">'; cobras[7] = '<img src="cobra8.jpg">'; cobras[8] = '<img src="cobra9.jpg">'; cobras[9] = '<img src="cobra10.jpg">'; cobras[10] = '<img src="cobra11.jpg">'; cobras[11] = '<img src="cobra12.jpg">'; cobras[12] = '<img src="cobra13.jpg">'; cobras[13] = '<img src="cobra14.jpg">'; cobras[14] = '<img src="cobra15.jpg">'; var numberchosen=math.floor(math.random()*15);   function makedisappear() {     var elem = document.getelementbyid("main");     elem.style.visibility = "hidden";     var elem = document.getelementbyid("empty");     elem.style.visibility = "visible";      var bodye1 = document.body;     bodye1.innerhtml += cobras[numberchosen]; } 

but adds image aligned left, , want align @ center. here's i've tried:

var bodye2 = document.getelementbyid("parte"); bodye2.innerhtml = cobras[numberchosen]; 

and here's how call it:

<center>      <img id="parte" src=" ' + cobras[numberchosen] +  ' "> </center> 

but image doesn't appear, , if inspect element, there's img src="cobras7" "inside" image part, like:

\/ <img id = "parte" src=" ' + cobras[numberchosen] + ' ">          <img src="cobras7"> 

any ideas?


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -