Hey guys, can someone show me how to detect height within a DIV tag, and redirect? For example if the height is 0, redirect to some other specified site I've read this but still no idea how to implement to redirect http://www.sitepoint.com/forums/showthread.php?t=394508 I'll be paying $10 for thos who get it working
I think this example will help you: <html> <head> <title>Redirect</title> </head> <body> <div id="test">Hello World!</div> </body> <script type="text/javascript"> if(document.getElementById("test").offsetHeight==0){ location.href = "http://rubensargsyan.com/"; } </script> </html> Code (markup):
Thanks alot. But can you give me a full example? Live if the DIV concerned are as follows <DIV ID=check>content</DIV> Would this work <script type="text/javascript"> if(document.getElementById("check").offsetHeight==0){ location.href = "http://rubensargsyan.com/"; } </script>
Yes, it has to work!!! <DIV ID=check>content</DIV> <script type="text/javascript"> if(document.getElementById("check").offsetHeight==0){ location.href = "http://rubensargsyan.com/"; } </script> If the div content is empty it will redirect.
<DIV ID=check>content</DIV> <script type="text/javascript"> if(document.getElementById("check").offsetHeight<10){ location.href = "http://rubensargsyan.com/"; } </script>