/    Sign up×
Community /Pin to ProfileBookmark

New Window in Black

I am using the following code to open a new window to view a photo:

[COLOR=Blue]<script type=”text/javascript”>
newWin=null
function openWin(pic) {newWin=window.open(pic,’win1′)
newWin.focus()}
onunload=function() {if(newWin && !newWin.closed) {newWin.close()}}
</script>

<a href=”aligator.jpg” onclick=”openWin(this.href); return false”><img alt=”aligator” src=”aligator.jpg” width=”100″ height=”150″ border=”3″></a>[/COLOR]

Is it possible to have the new window open as a frame covering the screen with a black background?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@konithomimoOct 22.2006 — make it open fullscreen and then simply set the background of the body to be black. In IE you can use fullscreen, in other browsers you have to get the screen width and height and then set the width and height of the new window to those values.
Copy linkTweet thisAlerts:
@royceauthorOct 22.2006 — Thanks for the good advice.

I am having trouble placing the background color code without getting script errors. Suggestions?
Copy linkTweet thisAlerts:
@yearbassOct 23.2006 — yeah, you can make it by simply generate HTML code on the fly.

this is the script
[code=php]<script type="text/javascript">
newWin=null;
function openWin(pic) {

newWin = window.open("","");
newWin.document.open();
newWin.document.write ("<html><head><title>" +pic+ "</title></head><body bgcolor='#000000'>");
newWin.document.write ("<img src='" +pic+ "'>");
newWin.document.write ("</body></html>");
newWin.document.close();
newWin.focus();

}
onunload=function() { if(newWin && !newWin.closed) {newWin.close()} }
</script>


<a href="aligator.jpg" onclick="openWin(this.href); return false">
<img alt="aligator" src="aligator.jpg" width="100" height="150" border="3">
</a>[/code]
×

Success!

Help @royce 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.29,
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,
)...