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 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2005
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    need help running two sricpts on one page

    I know this is easy, everything I have read on the topic makes sense yet I have struggled for 2 days now with no progess.

    Heres the problem: I am running two javascripts on the same page and they are interfering with eachother b/c of the <body= onload handler... what do i need to do these so both will run without interference??

    Heres how the page looks from step 1.
    <html>
    <head>
    <script type='text/javascript'>
    window.onload=function () {
    for(var i=0; imgEle=document.getElementsByTagName('img')[i];i++)
    if (imgEle.height > 500){ imgEle.width = Math.round(((500)/imgEle.height)*imgEle.width); imgEle.height = (500); }
    }
    </script>
    </head>

    <body onload="document.getElementsByTagName('input')[0].focus();">
    </body>
    </html>

    Thanks in advance.

  • #2
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <html>
    <head>
    <script type='text/javascript'>
    function init() {
    for(var i=0; imgEle=document.getElementsByTagName('img')[i];i++)
    if (imgEle.height > 500){ imgEle.width = Math.round(((500)/imgEle.height)*imgEle.width); imgEle.height = (500); }
    
    document.getElementsByTagName('input')[0].focus();
    }
    </script>
    </head>
    
    <body onload="init()">
    </body>
    </html>
    however i think there is more wrong with your code. the for loop looks a little off.
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<


  •  

    Posting Permissions

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