vbnullchar Posted June 12, 2007 Share Posted June 12, 2007 how will i know i know if an elementID already exist? Link to comment https://forums.phpfreaks.com/topic/55237-solved-div-problem/ Share on other sites More sharing options...
Goose Posted June 12, 2007 Share Posted June 12, 2007 if(typeof(document.getElementById('element_id')) === 'object'){ // it exists } Link to comment https://forums.phpfreaks.com/topic/55237-solved-div-problem/#findComment-273020 Share on other sites More sharing options...
vbnullchar Posted June 12, 2007 Author Share Posted June 12, 2007 thanks, but i cant get it to work function init_child_im_window(id,title){ if(typeof(document.getElementById('winBody_'+id)) === 'object'){ alert('found'); } else { var im_window=new child_im_window(600,300,300,200,title,id,""); document.body.appendChild(im_window) } } heres the scene im creating a chat application now i need to check if the window is alread open if not i should create one Link to comment https://forums.phpfreaks.com/topic/55237-solved-div-problem/#findComment-273053 Share on other sites More sharing options...
vbnullchar Posted June 12, 2007 Author Share Posted June 12, 2007 Got it! function init_child_im_window(id,title){ if(!document.getElementById('winbody_'+id)) { var im_window=new child_im_window(600,300,300,200,title,id,""); document.body.appendChild(im_window) } } Link to comment https://forums.phpfreaks.com/topic/55237-solved-div-problem/#findComment-273060 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.