|
|||||
|
|
#1 |
|
Registered User
Join Date: Oct 2002
Location: Quebec, Canada
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
|
HTML : Hiding IE scroll bar
Hi !
Is there a way to hide the scroll bar without using frames ?
__________________
"All animals are equal. But some are more equal than others. " -George Orwell |
|
|
|
|
|
#2 |
|
PG Rated
|
Hey Schwinnz
Yes there is a way, and I've written a little script for you to make it work. Code:
<html>
<head>
<title>Show Hide Scrollbars</title>
<script name="Detect Browser" language="Javascript">
var detect = navigator.userAgent.toLowerCase();
var browser,thestring;
if (checkIt('msie'))
{
browser = "Internet Explorer";
}
else if (!checkIt('compatible'))
{
browser = "Netscape Navigator";
}
else browser = "An unknown browser";
function checkIt(string)
{
place = detect.indexOf(string) + 1;
thestring = string;
return place;
}
</script>
<script
name="Add and Remove Scroll Bars" language="Javascript">
function noScrollIE()
{
document.body.scroll="no";
}
function scrollIE()
{
document.body.scroll="yes";
}
function noScrollNS()
{
document.width= window.innerWidth;
document.height=window.innerHeight;
}
function scrollNS()
{
document.width=1000;
document.height=1000;
}
</script>
<script "Do the work" language="Javascript">
function removeScrollBars()
{
if (browser = "Internet Explorer")
{
noScrollIE();
}
else if (browser = "Netscape Navigator")
{
noScrollNS();
}
}
</script>
</head>
<body onload="removeScrollBars()">
<a href="javascript:noScrollIE();">IE Scrollbars Off</a><br>
<a href="javascript:scrollIE();">IE Scrollbars On</a><br>
<a href="javascript:noScrollNS();">NS Scrollbars Off</a><br>
<a href="javascript:scrollNS();">NS Scrollbars On</a><br>
</body>
</html>
It is a longish script, but it's worth it, because then they get removed for the two major browsers and it is not browser specific (not really anyway). The Threedy forums seem to put a space between the words "java" and "script" in the <a href> tags ... if they are still there when you have copy/pasted it, just remove the space. I hope this helps, Nik
__________________
Be Unafraid. Be very Unafraid. Last edited by Little Nicky; 16-03-2003 at 02:39 AM.. |
|
|
|
|
|
#3 |
|
Registered User
Join Date: Oct 2002
Location: Quebec, Canada
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
|
I found that on the internet in another form but is there a way to automatically hide it ?
__________________
"All animals are equal. But some are more equal than others. " -George Orwell |
|
|
|
|
|
#4 |
|
Purple Ninja
Join Date: Oct 2002
Location: Australia
Posts: 110
Thanks: 0
Thanked 0 Times in 0 Posts
|
what do you mean?
you could just put scroll="no" in your body tag if you're lazy... |
|
|
|
|
|
#5 |
|
Purple Ninja
Join Date: Oct 2002
Location: Australia
Posts: 110
Thanks: 0
Thanked 0 Times in 0 Posts
|
and also scroll="auto" if you want it to scroll only when there is too much content to fit on the one screen...
|
|
|
|
|
|
#6 |
|
Registered User
Join Date: Oct 2002
Location: Quebec, Canada
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
|
Thank you, that's what I was looking for.
![]()
__________________
"All animals are equal. But some are more equal than others. " -George Orwell |
|
|
|
|
|
#7 |
|
PG Rated
|
The one I gave is automatic — it just works on both IE and NS — if you just put scroll="no" in the body tag then it will only work on IE. It is best to be crossbrowser, but it's your choice of course.
__________________
Be Unafraid. Be very Unafraid. |
|
|
|
|
|
#8 |
|
Purple Ninja
Join Date: Oct 2002
Location: Australia
Posts: 110
Thanks: 0
Thanked 0 Times in 0 Posts
|
mmm, seems a fair bit off effort to just hide the scrollbar though
![]() |
|
|
|
|
|
#9 |
|
Registered User
Join Date: Oct 2002
Location: Quebec, Canada
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
|
Oh little nicky I just understood how your script works... I'm so bad at scripting...
__________________
"All animals are equal. But some are more equal than others. " -George Orwell |
|
|
|
|
|
#10 |
|
PG Rated
|
That's alright Schwinnz
.Tim: Yeah I know it seems a lot and there might be another way to do it, but I have just got into the habit of making everything as crossbrowser as possible .Anyway ... some habits are good and some bad ...
__________________
Be Unafraid. Be very Unafraid. |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|