javascript - document.getElementById returning element in firefox but not chrome -



javascript - document.getElementById returning element in firefox but not chrome -

i trying dynamically load coverflow type object (think itunes coverflow less fancy) on button click after webpage has loaded. dynamically creating list of images feed javascript coverflow loads them , it's magic create pretty. problem in firefox code working, in chrome , ie (surprise surprise) javascript throwing error , page going blank due error throw below. problem in block of code trying capture dom element id

if (typeof(this.container) == 'string') { // no node var container = document.getelementbyid(this.container); if (container) { this.container = container; } else { throw ('contentflow error: no element id \''+this.container+'\' found!'); return; } }

pretty much in chrome dome element not captured code above when available in page. typed out document.getelementbyid("container_name"); in console of chrome , returned element clueless whey won't work in file.

any suggestions appreaciated

thanks

edit:

here onpage html trying filled

<div id="contentflow" class="cool_ui contentflow"> <p id="coverflow_school_name"></p> <div class="loadindicator"><div class="indicator"></div></div> <div class="flow" style="height:240px;"></div> <div class="scrollbar"> <div class="slider"></div> </div> </div>

answered:

wow, ok. figured out. problem way resources beingness dynamically loaded before phone call piece of code. resource loading causing page go blank, making var container = document.getelementbyid(this.container); homecoming null hence exception beingness thrown. weird part firefox handle resource loading, chrome not.

thanks help

why not utilize jquery?

$('#container_name')

update: on sec reading, name or id of element?

if name thenn utilize

$('[name="container_name"]')

javascript jquery firefox dom google-chrome

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -