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 6 of 6

Thread: Locating pics

  1. #1
    New Coder
    Join Date
    Jan 2003
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Locating pics

    I have two images i am using...and i want to locate one on top of the other...

    the first is called Frame.jpg and the one i want on top of it is Button1.gif

    i tried locating button1 using the code as follows
    <html>
    <head>
    <script type="text/javascript">
    <!--
    function placebut1()
    {
    if (document.all)
    {
    document.all("button1").style.left=100
    document.all("button1").style.top=100
    }
    else if (document.layers)
    {
    document.layers["button1"].left=100
    document.layers["button1"].top=100
    }
    }
    //-->
    </script>
    </head>

    <body bgcolor="#000000">
    <script type="text/javascript">
    placebut1()
    </script>
    <td><p align="center"><img name="Frame" src="Frame.jpg">
    </td>
    <span id="button1"><img name="Button1" src="Button1.gif" height="40"

    width="40" border="0"></span>
    </body>
    </html>
    can someone help me?

    thx in advance

    ~PlystirE~
    CHAOS! DISORDER! MAYHEM!
    My job here is obviously done.
    ~ Plystire

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    use the universal document.images[]
    Code:
    <html> 
    <head> 
    <script type="text/javascript"> 
    <!-- 
    function placebut1() {
    document.images[0].style.top = 100; // or document.images["Button1"].style etc...
    document.images[0].style.left = 100;
    } 
    //--> 
    </script> 
    </head>

  • #3
    New Coder
    Join Date
    Jan 2003
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy nope

    it didn't do anything different than the method i had

    what am i doing wrong?

    ~PlystirE~
    CHAOS! DISORDER! MAYHEM!
    My job here is obviously done.
    ~ Plystire

  • #4
    New Coder
    Join Date
    Jan 2003
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    errors

    it gives me errors...i think it doesn't like my meathod of positioning the images

    i'm getting really frustrated with it

    ~PlystirE~
    CHAOS! DISORDER! MAYHEM!
    My job here is obviously done.
    ~ Plystire

  • #5
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try this.
    Code:
    <html> 
    <head> 
    <script type="text/javascript"> 
    <!-- 
    function placebut1() {
    document.images[0].style.position = "absolute";
    document.images[0].style.top = "100"; // or document.images["Button1"].style etc...
    document.images[0].style.left = "100";
    } 
    //--> 
    </script> 
    </head>

  • #6
    New Coder
    Join Date
    Jan 2003
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb found it

    i found out why it wasn't working...for some reason it needed me to say


    #button1 {
    position:absolute;
    left:0;
    top:0;
    visibility:hide;
    visibility:hidden;
    width:40;
    height:40;
    }

    and...

    document.all("button1").style.visibility = "visible";

    even though it was visible before :S

    and now it locates to the position i want it to

    thank you for the help chrismiceli

    ~PlystirE~
    CHAOS! DISORDER! MAYHEM!
    My job here is obviously done.
    ~ Plystire


  •  

    Posting Permissions

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