vbnullchar Posted June 12, 2007 Share Posted June 12, 2007 how will i know i know if an elementID already exist? Quote 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 } Quote 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 Quote 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) } } Quote Link to comment https://forums.phpfreaks.com/topic/55237-solved-div-problem/#findComment-273060 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.