Hello everyone i have a google blog and we post many pages in my blog.

and we add a div like <div id='header'> .
the header div show all of the pages but i want to show my header only main page.
'www.myblogsite.blogspot.com/'
and hide all of other pages using a java script.
if anyone open my site 'www.myblogsite.blogspot.com/'
the <div id='header'> unhide
if the the visitor visit another page then hide <header>
please help.

Recommended Answers

All 8 Replies

I think you can use window.location and check if .com is at the end of the url.

butt how to do this ?
we need a code.
please anybody give me the code
i am awaiting a good response

Text questions will most likely attract text answers. If you want code, then provide code.

No thank you. i do resolve it now.
We have solved the problem myself.

yeeeeeeeeeehhhhhhhhheeeeeeeeeeee
i am so happy because we join java language before one day.but i did that..
Where you could not helped us.there my God helped us .
haha
Thanks God Thanks Alot.
But pritaeas and Airshow thanks for reply .

we share this code for who people was could not do this.
goto this site and check script online .

<!DOCTYPE html>
<html>
<style>
/*this is your div tag class. if you want to change div class you can change it */
#demo{
display:show;
color: violet;
}
/*End div tag class*/
</style>

<script stype="text/javascript">
var mysiteurl = location.host;
var newurl = 'www.w3schools.com';

if( newurl==mysiteurl ){
alert('url was match')
document.getElementById('demo').style.display = "show";
}else {
alert('url was not match')
document.getElementById('demo').style.display = "none";
}
</script>
<body>

<div id="demo">This my div tag value so we want to hide.</div>

</body>
</html>

We have solved the problem myself.

That's cool Razamughal67, well done.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.