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
    Dec 2004
    Location
    Crown Point, IN
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts

    sending a variable?

    is there a way to send a variable containing words to an included file which holds a function?

    this is my call statement...
    PHP Code:

    if(selobj.options[idx].id!="")
        {
        var 
    stat=selobj.options[idx].id;
        
    scroll(stat);
        }
    }
    //-->
    </SCRIPT>
    <script type='text/javascript' src='status_2.js'></script>
    </HEAD> 
    and this is 'status_2.js'
    PHP Code:
    // JavaScript Document
    <!-- hide
    var count 0
    function 
    scroll (stat) {
    window.status=stat.substring (countstat.length)+stat.substring
    (0,count)
    if (
    count<text.length)
    count ++;
    else
    count=0;
    setTimeout ("scroll(stat)"75);
    }
    //--> 
    is there a way to send that variable, or will i just have to transfer it all to the one file?

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,495
    Thanks
    3
    Thanked 500 Times in 487 Posts
    your code =

    PHP Code:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd"
    >

    <
    html>

    <
    head>
      <
    title></title>
    <
    script language="JavaScript" type="text/javascript">
    <!--
     if(
    selobj.options[idx].id!="")
        {
        var 
    stat=selobj.options[idx].id;
        
    scroll(stat);
        }
    }
    //-->
    </script>
    <script language="JavaScript" type="text/javascript">
    <!--
    var count = 0;
    function scroll (stat) {
    window.status=stat.substring (count, stat.length)+stat.substring
    (0,count)
    if (count<text.length)
    count ++;
    else
    count=0;
    setTimeout ("scroll(stat)", 75);
    }
    //-->
    </script>
    </head>

    <body>

    </body>

    </html> 
    ie the external js is inserted in the page as the page is rendered


  •  

    Posting Permissions

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