Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    May 2003
    Location
    London UK
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    FL, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    New to the CF scene
    Join Date
    May 2003
    Location
    London UK
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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)

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    FL, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    ColoRockyz
    Posts
    1,650
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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:
    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.
    Last edited by zoobie; 05-27-2003 at 07:28 AM.
    Zoobie or not Zoobie...That is the problem.
    <body onUnload="flush( ! )">

  • #6
    New to the CF scene
    Join Date
    May 2003
    Location
    London UK
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    ColoRockyz
    Posts
    1,650
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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?)
    Last edited by zoobie; 05-27-2003 at 09:30 PM.
    Zoobie or not Zoobie...That is the problem.
    <body onUnload="flush( ! )">


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •