Guest smallsand Posted May 6, 2006 Share Posted May 6, 2006 Hi i have a problem and this is my code<div style="position:relative; visibility:visible;" id="obj"> <table><tr><td> Something here </td></tr></table></div>and this my javascript codefunction showDetail(obj){ var style=obj.style; if (style.position=='relative' || style.visibility=='visible'){ style.position='absolute'; style.visibility='hidden'; style.zIndex=-1; }else { style.position='relative'; style.visibility='visible'; style.zIndex=1; }}i want when i click on something (for example an image) the all of the content of the div tag will be hidden, and the next time , it's content will be shown, but it not showi dont know why, i have replaced the table tag by the normal text and it' okPlease tell me something about that problem!!!!Thanks very much Link to comment Share on other sites More sharing options...
scott100 Posted May 6, 2006 Share Posted May 6, 2006 This should help you get started. <head><script>function showDetail(){var style=document.getElementById('obj').style.visibility; if (style=='visible') { document.getElementById('obj').style.visibility='hidden'; }else document.getElementById('obj').style.visibility='visible';}</script></head><body><input type="button" value="click me" onclick="showDetail()"><div style="position:relative; visibility:visible;" id="obj"><table><tr><td>Something here</td></tr></table></div></body> Link to comment Share on other sites More sharing options...
Jack McKalling Posted May 6, 2006 Share Posted May 6, 2006 I think, but it may have got nothing to do with this, is that the position property also needs the "top" and "left" property in conjuction, to work Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now