# Javascript help

**URL:** <https://forum.kirupa.com/t/javascript-help/283278>\
**Category:** Uncategorized\
**Created:** [March 4, 2009, 1:23pm UTC](https://forum.kirupa.com/t/javascript-help/283278 "2009-03-04T13:23:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jusko](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jusko](https://forum.kirupa.com/u/jusko)\
**Post date:** [March 4, 2009, 1:23pm UTC](https://forum.kirupa.com/t/javascript-help/283278/1 "2009-03-04T13:23:03Z")

</div>

Hi!

I need to hide a Div with an id (ApDiv1) depending on the window.location. I’m using this script, but nothing happens… Any suggestions??

\<script type=“text/javascript”\>  
function hideDiv() {  
var url = “[http://www.example.com.pt/catalog/index.php](http://www.example.com.pt/catalog/index.php)”;  
if (document.location.href == url) {  
document.getElementById(“apDiv1”).style.visibility=‘visible’;  
} else {  
document.getElementById(“apDiv1”).style.visibility=‘hidden’;  
}  
}  
\</script\>

I would like that when the url would be something like this:  
[http://www.example.com.pt/catalog/index?cPath=32\_32](http://www.example.com.pt/catalog/index?cPath=32_32)  
or anything else, the Div would hide…

Thanks in advance!
