PDA

View Full Version : scrollbars



benslayton
05-26-2006, 05:15 PM
Is there any way of hiding the scrollbars in a window.

Jack
05-26-2006, 05:24 PM
Iíve got a few things on the go right now but YES you can hide the scroll bar.
If you havenít figured it out by the time I get back Iíll show you. God willing of course! :)

djr33
05-26-2006, 05:46 PM
It's a really bad idea.
If you don't want scrollbars, limit the size of your page.

the scrollbars are a functionality issue... they serve a purpose. They aren't graphics for you to play with.

That's like disabling the mouse cursor when it's above your page. It doesn't help and just makes things weird.

Maybe you've got a special case, though.

benslayton
05-26-2006, 05:51 PM
actualy I do have a special case. please tell me how. the only thing I found was the colors. and I tried changing it to the back. color.

Jack
05-26-2006, 10:09 PM
Okay, place the following in the <head> section of your page.

<script language="javascript" type="text/javascript">
<!--
/****************************************************
Author: Eric King
Url: http://redrival.com/eak/index.shtml
This script is free to use as long as this info is left in
Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,re sizable=no';
win=window.open(mypage,myname,settings);}
// -->
</script>

And use the following as your link. (Edit the size of the page and URL)

<a href="http://www.google.com#CLICK HERE" onclick="NewWindow(this.href,'','1024','600','yes','top');return false" onfocus="this.blur()">Click Here</a>

Hope that's what you're looking for.

tech_support
05-27-2006, 05:52 AM
Or, a much more simple way put this:



<a href = "http://www.google.com#CLICK HERE" onclick="window.open(this.href,'mywindow','width=1024;height=600;scrollbars=no');return false;">My Link</a>

djr33
05-27-2006, 06:01 AM
Doesn't seem to work using Mozilla or Safari. Used that text directly, didn't change much... maybe there's something that I needed to customize.

Also, that's for a popup.

I believe the question is to change the current window (or set it in the first place.)

This would probably be more of a CSS question than javascript, though I'm not sure.

Also, from what I know JS can only close a window it opened. In the same sense, I doubt that you can change the properties of a window that the js didn't open.
Might be wrong, though, but I've heard of this, or at least very similar situations in which it's been said to be a security issue, and disabled.... I bet it's the same here.

However, if you're talking about frames (as some of your other threads have hinted), I believe that you can specify scrolling:no, in the css for that frame... but.. that may be wrong syntax... I've just seen it in passing.

And... what is your "special case" that causes you to need to change how browsers work?
No matter what you're doing, the visitor should still be able to scroll the page... that's kinda the point.
but... maybe you've got a good reason... not saying you don't, but just that generally, it's not a good reason to change how the browser functions.

shachi
05-27-2006, 07:04 AM
The best way is to put up a div <div id="mydiv"></div> with styles as follows:



#mydiv{
height: 100%;
width: 100%;
overflow: hidden;
}

and to place all the contents inside the div :



<div id="mydiv">
Some content ...
<some table>
and blah blah blah
</div>


and to put some script like this (if you want to scroll) http://dhtmlgoodies.com/scripts/scrollable_div/scrollable_div.html

Jack
05-27-2006, 12:26 PM
Or, a much more simple way put this:



<a href = "http://www.google.com#CLICK HERE" onclick="window.open(this.href,'mywindow','width=1024;height=600;scrollbars=no');return false;">My Link</a>


Actually without the rest of the script it doesn't work. At least not in IE.

Twey
05-27-2006, 12:45 PM
The spaces around the = sign probably don't help.

tech_support
05-28-2006, 05:48 AM
Actually without the rest of the script it doesn't work. At least not in IE.

Really? Worked for me

tech_support
05-28-2006, 07:41 AM
Here's the script:

But only two problems here:

1. It opens in a new window (But same page at least!)
2. You can't go back (Because it's in a new window)

But here it is anyway:



<html>

<head>
<meta http-equiv="Content-Language" content="en-au">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>My Page</title>
</head>

<body onbeforeunload="check()" onunload="check()" onload="DisplayInfo();check()">
<font face="Verdana"><font size="6">My Page</font>
<script>

function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0)
break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (2 < argc) ? argv[2] : null;
var path = (3 < argc) ? argv[3] : null;
var domain = (4 < argc) ? argv[4] : null;
var secure = (5 < argc) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DisplayInfo() {
var expdate = new Date();
var visit;
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
if(!(visit = GetCookie("visit")))
visit = 0;
visit++;
SetCookie("visit", visit, expdate, "/", null, false);
var message;
if(visit == 1)
load()
resetme = 0
if(visit == 2)
visit = 0
resetme = 1
if(visit == 3)
visit = 0
resetme = 1

}

function ResetCounts() {
var expdate = new Date();
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
visit = 0;
SetCookie("visit", visit, expdate , "/", null, false);
}


function load() {

newwin=window.open("my_page.htm","thispage","scrollbars=no,toolbars=yes,location=yes,directories=yes,status=yes,menubar=yes,toolbar=yes")
if (newwin) {
setTimeout("window.opener = self;window.close()",1000)

}
else {
alert("Something's wrong! You need to disable your pop-up blocker before continuing!")
return false;
}
}

var resetme = 0

function check() {

if (resetme==0) {

return;
}
if (resetme==1) {

ResetCounts()
resetme==0
}

}
</script></font>
<p>&nbsp;</p>
<p><font face="Verdana" size="2">Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Aliquam semper ullamcorper lacus. Nulla ligula. Vivamus et nibh.
Phasellus tempus mi vitae diam. Vestibulum bibendum, purus id laoreet convallis,
eros est accumsan dui, a suscipit nisl dui ac velit. Fusce felis diam, egestas
vel, tempor eget, pharetra at, tellus. Nullam gravida, nibh in egestas
scelerisque, leo velit congue nisi, nec luctus tellus urna quis dolor. Quisque
libero tellus, tempus vitae, fermentum et, auctor ut, quam. Proin rhoncus. Nam
metus ante, semper at, rutrum in, tincidunt et, augue. Morbi nec odio ac velit
suscipit condimentum. Aenean augue. Curabitur at ipsum id mi consequat rutrum.
Phasellus et nibh. In molestie suscipit quam. Fusce tempor porta lorem. In eu
lorem. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur
ridiculus mus. Sed vitae risus. <br>
<br>
Pellentesque ornare quam sit amet leo. Cras sed tellus ac purus iaculis
malesuada. Maecenas vel orci sit amet lorem vehicula auctor. Nulla est justo,
porttitor non, condimentum ac, sollicitudin in, mi. Cras porta ante. Quisque
hendrerit, arcu id luctus imperdiet, elit lectus pellentesque lacus, sit amet
dapibus nisi nisi et ante. Integer orci. Etiam dapibus metus ut dui. Praesent
fermentum, nulla in adipiscing sollicitudin, massa libero consequat felis, ac
venenatis odio nisi vitae nunc. Praesent quis turpis ut dui accumsan commodo.
Nunc vitae urna. <br>
<br>
Mauris venenatis lacinia arcu. Sed sed ante malesuada tellus accumsan viverra.
Mauris vel magna non urna rhoncus facilisis. Mauris consectetuer nulla eu sem.
Nam tincidunt nunc eu arcu. Mauris convallis tristique nulla. Morbi ac tellus ut
urna ornare suscipit. Pellentesque auctor sagittis ipsum. In id mi. In hac
habitasse platea dictumst. Quisque ultrices tristique quam. Sed massa ipsum,
aliquam ut, facilisis vitae, faucibus vel, nibh. <br>
<br>
Ut in mauris. Donec velit risus, porta vitae, convallis eu, luctus id, lacus.
Vestibulum dignissim consequat leo. Class aptent taciti sociosqu ad litora
torquent per conubia nostra, per inceptos hymenaeos. Sed tristique arcu. Vivamus
porttitor erat sed augue. Nulla iaculis quam eu neque. Etiam sed magna. Fusce
tristique, sem sit amet feugiat auctor, lectus eros ornare nisi, nec feugiat
lorem lorem sit amet dolor. Praesent fermentum. <br>
<br>
Praesent interdum pulvinar libero. Viva

Twey
05-28-2006, 12:06 PM
http://validator.w3.org/

tech_support
05-28-2006, 11:39 PM
Sorry... Not using Dreamweaver!

Twey
05-28-2006, 11:42 PM
All the more reason to write decent code :)