if statement - Javascript write variable with IF/ELSE and insert it in a other var -
i have next problem:
var widowwidth = 0,w=window,d=document,e=d.documentelement,g=d.getelementsbytagname('body') [0],x=w.innerwidth||e.clientwidth||g.clientwidth; if( x > 1624) { widowwidth = 1800 / (10 + 2); } else { widowwidth = 800 / (10 + 2); }
now want give meternum var: windowwidth
_drawspectrum: function(analyser) { var = this, canvas = document.getelementbyid('canvas'), cwidth = canvas.width, cheight = canvas.height - 2, meterwidth = 10, gap = 10, capheight = 2, capstyle = '#fff', meternum = windowwidth, // <----- here
is there simple way or did mistake, because dosen't work :(
thank you, tim4497
at variable initialization , in if else statements you're defining variable widowwidth instead of windowwidth. if variable's other half isn't dead yet, need right create work.
javascript if-statement var
No comments:
Post a Comment