Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-25-2003, 04:34 PM   PM User | #1
whitebird
New to the CF scene

 
Join Date: May 2003
Location: London UK
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
whitebird is an unknown quantity at this point
Animated window color

Hi!

I am using a very nice animated window script from javascript.com. The problem I am having is that as the window is loading in it is white and I would like to change the color. Possible?

Here's the script
<html>
<head>
<title>Untitled</title>
</head>

<body bgcolor="#000000" link="#ffffff">

<script>
<!--
<!--Animated Window Opener script-By JavaScript Kit (www.javascriptkit.com) More scripts here-->
var mylocation=""
var winheight=100
var winsize=100
var x=5

function go(){
win2=window.open("","","scrollbars")
if (!document.layers&&!document.all){
win2.location=mylocation
return
}
win2.resizeTo(100,100)
win2.moveTo(0,0)
go2()
}
function go2(){
if (winheight>=screen.availHeight-3)
x=0
win2.resizeBy(5,x)
winheight+=5
winsize+=5
if (winsize>=screen.width-5){
win2.location=mylocation
winheight=100
winsize=100
x=5
return
}
setTimeout("go2()",50)
}
//-->
</script>


<a href="javascript:go()" onMouseover="window.status='open window';return true" onMouseout="window.status=''" >
Click here</a>

</body>
</html>

Thanks for any help
Maureen
whitebird is offline   Reply With Quote
Old 05-25-2003, 04:54 PM   PM User | #2
ACJavascript
Regular Coder

 
Join Date: Jun 2002
Location: FL, USA
Posts: 734
Thanks: 0
Thanked 0 Times in 0 Posts
ACJavascript is on a distinguished road
Hello maureen,
Well you could accomplis this two ways.

the page that is loading inside the window itself could be a different color. Or you could use the code below

I boldfaced what I added,, you can set the color were it says bgColor=" "
--------
<html>
<head>
<title>Untitled</title>
</head>

<body bgcolor="#000000" link="#ffffff">

<script>
<!--
<!--Animated Window Opener script-By JavaScript Kit (www.javascriptkit.com) More scripts here-->
var mylocation=""
var winheight=100
var winsize=100
var x=5

function go(){
win2=window.open("","","scrollbars")
win2.document.write("<html><head><title></title></head><body bgColor=\"black\"></body></head></body>")
if (!document.layers&&!document.all){
win2.location=mylocation
return
}
win2.resizeTo(100,100)
win2.moveTo(0,0)
go2()
}
function go2(){
if (winheight>=screen.availHeight-3)
x=0
win2.resizeBy(5,x)
winheight+=5
winsize+=5
if (winsize>=screen.width-5){
win2.location=mylocation
winheight=100
winsize=100
x=5
return
}
setTimeout("go2()",50)
}
//-->
</script>


<a href="javascript:go()" onMouseover="window.status='open window';return true" onMouseout="window.status=''" >
Click here</a>

</body>
</html>
-------

Hope this helps
__________________
CYWebmaster.com - See why we dot com!!
ACJavascripts.com - Cut & Paste Javascripts!
SimplyProgram.com - Personal Blog
ACJavascript is offline   Reply With Quote
Old 05-26-2003, 08:08 AM   PM User | #3
whitebird
New to the CF scene

 
Join Date: May 2003
Location: London UK
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
whitebird is an unknown quantity at this point
Re Animated window color

Thanks a lot for that. It works and is exactly what I needed. If I were to load an image instead of a bgColor and maybe write some text how would the code for that look? Is it written differently to normal HTML code for the dicument.write function. EG Normally
written <body background="xxx.jpg"> I see there are two \ \ before and after "black" in your code.

Here's the section again!

function go(){
win2=window.open("","","scrollbars")
win2.document.write("<html><head><title></title></head><body bgColor=\"black\"></body></head></body>")
if (!document.layers&&!document.all){
win2.location=mylocation
return

Thank you so much for your help. It will save me a lot of time otherwise spent trying to figure it out. (I am a javascript learner)
Maureen)
whitebird is offline   Reply With Quote
Old 05-26-2003, 06:55 PM   PM User | #4
ACJavascript
Regular Coder

 
Join Date: Jun 2002
Location: FL, USA
Posts: 734
Thanks: 0
Thanked 0 Times in 0 Posts
ACJavascript is on a distinguished road
Isn't it fun to learn

I am glad to help maureen.

Yes for an image you would use the normail HTML for it.

background="xx.jpg"

I placed the \" around the color becuase the document.write("") code incloses the html with " ". The first one to start it and the second to end it. The \ before the " covers it and says to the document.write its not the end,,

Proably not the best description of it hehee sorry


if you want some test just put some in like so


win2.document.write("<html><head><title></title></head><body bgColor=\"black\">HI THERE!</body></head></body>")



Happy Javascripting
__________________
CYWebmaster.com - See why we dot com!!
ACJavascripts.com - Cut & Paste Javascripts!
SimplyProgram.com - Personal Blog
ACJavascript is offline   Reply With Quote
Old 05-27-2003, 05:20 AM   PM User | #5
zoobie
Senior Coder

 
Join Date: Jun 2002
Location: ColoRockyz
Posts: 1,642
Thanks: 1
Thanked 0 Times in 0 Posts
zoobie has a little shameless behaviour in the past
You don't wanna do that with this script. First, make your page, then point to it with var mylocation="my_new_page.html"
If all else fails, read the directions:
Quote:
Directions: Simply insert the below into the <body> section of your page: Change the url in "mylocation" to your own. var mylocation="new_page.html"
...and take out the space in "javascript" not <a href="javascript:go()" if there is one.
__________________
Zoobie or not Zoobie...That is the problem.
<body onUnload="flush( ! )">

Last edited by zoobie; 05-27-2003 at 06:28 AM..
zoobie is offline   Reply With Quote
Old 05-27-2003, 09:03 AM   PM User | #6
whitebird
New to the CF scene

 
Join Date: May 2003
Location: London UK
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
whitebird is an unknown quantity at this point
RE animation window color

Hi there!

I don't think you quite understand the script completely as it is for an ANIMATION WINDOW. Meaning it opens diagonally across the page from top left and fills the screen with the full window slowly. The "my location" page is loaded into the full screen window once it has completely opened.

The problem was to get the ANIMATED WINDOW to contain something instead of being a blank white window. Looked very boring as it opened up before the "my location" document loaded into it. I needed to stick with this particular script to achieve the animation effect.

That problem was solved by the advice from AC Javascripts and works exactly as I wanted. It was not a question of simply opening a full screen window but rather the ANIMATED version.

Thanks for your input and your suggestion will be very useful for another time when the window does not need to be animated.

Maureen
whitebird is offline   Reply With Quote
Old 05-27-2003, 08:18 PM   PM User | #7
zoobie
Senior Coder

 
Join Date: Jun 2002
Location: ColoRockyz
Posts: 1,642
Thanks: 1
Thanked 0 Times in 0 Posts
zoobie has a little shameless behaviour in the past
Ahhhhhhhhhh....You're welcome

You've got too many </head></body> tags in there.

Maybe put a title in there so it doesn't say about:blank, too.

(Who would write all that?)
__________________
Zoobie or not Zoobie...That is the problem.
<body onUnload="flush( ! )">

Last edited by zoobie; 05-27-2003 at 08:30 PM..
zoobie is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 +1. The time now is 12:46 AM.


Advertisement
Log in to turn off these ads.