/    Sign up×
Community /Pin to ProfileBookmark

Adding scrollbars on a popup?

Hi
This is the code I’m currently using to have a popup at 800×600 in the center of the screen:

[code]
<script language=”JavaScript”><!–
var w = 480, h = 340;

if (document.all || document.layers) {
w = screen.availWidth;
h = screen.availHeight;
}

var popW = 800, popH = 600;

var leftPos = (w-popW)/2, topPos = (h-popH)/2;

window.open(‘index800600.html’,’popup’,’width=’ + popW + ‘,height=’ + popH + ‘,top=’ + topPos + ‘,left=’ + leftPos);
//–></script>
[/code]

And everything works fine, but i want to allow scrollbars, i tried adding ‘scrollbars=yes’ but it just messed everything up.
Does anyone know where i should put the code,etc.?
thanks

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@FangSep 14.2004 — scrollbar=yes not scrollbar[COLOR=red]s[/COLOR]=yes
Copy linkTweet thisAlerts:
@try2dreamauthorSep 14.2004 — oh yeh sorry that was a mis-type in my post.

But what would that whole line be? (the line starting with window.open)

thanks
Copy linkTweet thisAlerts:
@FangSep 14.2004 — My mistake, it is scrollbars.

It is window.open('URL', 'windowName', ['windowFeatures'])

So in your example:
window.open('index800600.html','popup','scrollbar=yes,width="+popW+",height="+popH+",top="+topPos+",left="+leftPos+"');

Watch the nesting of quotes.
Copy linkTweet thisAlerts:
@try2dreamauthorSep 14.2004 — thanks for the code Fang, but it didnt work.

The window size fills the screen and doesnt stay at 800x600.
Copy linkTweet thisAlerts:
@FangSep 14.2004 — var Features="scrollbar=yes,width="+popW+",height="+popH+",top="+topPos+",left="+leftPos;
window.open('index800600.html','popup',Features);
Copy linkTweet thisAlerts:
@try2dreamauthorSep 15.2004 — Hey Fang,

That script opened the window at 800x600 and centered it on the screen but the scrollbars werent there. ?
Copy linkTweet thisAlerts:
@FangSep 15.2004 — They should appear if index800600.html is larger than 800x600.
Copy linkTweet thisAlerts:
@try2dreamauthorSep 15.2004 — when i type index800600.html straight into the browser it has scroll but with the popup there is no scroll. there would be a ghost scroll bar anyway yeh?
×

Success!

Help @try2dream spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...