>: CG Forums on 3dtotal - The best forums for CG artists :.
threedy forums home
 


top-table-gradient
Go Back   3DTotal Forums > Archives > Archives > Scripting & coding
bottom-table-gradient

Reply
 
Thread Tools Display Modes
Old 15-03-2003, 10:51 PM   #1
Schwinnz
Registered User
 
Schwinnz's Avatar
 
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
Schwinnz is offline   Reply With Quote
Old 16-03-2003, 02:36 AM   #2
Little Nicky
PG Rated
 
Little Nicky's Avatar
 
Join Date: Jan 2003
Location: Levin, New Zealand
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Little Nicky
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>
I've put the functions to put the scrollbars back on in case you need them. I've also put some links in the test page so you can test it.

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..
Little Nicky is offline   Reply With Quote
Old 16-03-2003, 03:12 AM   #3
Schwinnz
Registered User
 
Schwinnz's Avatar
 
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
Schwinnz is offline   Reply With Quote
Old 16-03-2003, 05:29 AM   #4
Tim_Cutho
Purple Ninja
 
Tim_Cutho's Avatar
 
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...
__________________
:: Tim Cutho ::
www.Tim3D.tk
» Making cubes in avatars cool since October '02 «
Tim_Cutho is offline   Reply With Quote
Old 16-03-2003, 05:30 AM   #5
Tim_Cutho
Purple Ninja
 
Tim_Cutho's Avatar
 
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...
__________________
:: Tim Cutho ::
www.Tim3D.tk
» Making cubes in avatars cool since October '02 «
Tim_Cutho is offline   Reply With Quote
Old 16-03-2003, 05:37 AM   #6
Schwinnz
Registered User
 
Schwinnz's Avatar
 
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
Schwinnz is offline   Reply With Quote
Old 16-03-2003, 08:43 AM   #7
Little Nicky
PG Rated
 
Little Nicky's Avatar
 
Join Date: Jan 2003
Location: Levin, New Zealand
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Little Nicky
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.
Little Nicky is offline   Reply With Quote
Old 16-03-2003, 09:03 AM   #8
Tim_Cutho
Purple Ninja
 
Tim_Cutho's Avatar
 
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
__________________
:: Tim Cutho ::
www.Tim3D.tk
» Making cubes in avatars cool since October '02 «
Tim_Cutho is offline   Reply With Quote
Old 16-03-2003, 02:51 PM   #9
Schwinnz
Registered User
 
Schwinnz's Avatar
 
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
Schwinnz is offline   Reply With Quote
Old 16-03-2003, 08:45 PM   #10
Little Nicky
PG Rated
 
Little Nicky's Avatar
 
Join Date: Jan 2003
Location: Levin, New Zealand
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Little Nicky
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.
Little Nicky is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 11:53 PM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
all images displayed on this site are copyright the original artists and may not be reproduced, copied or published elsewhere without their express permission