SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2010
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb Get a var from function of the file .htm

    I want to get a variable directly from the function m() of file 1.htm to file 2.htm

    File 1.htm writed:
    ===1.htm====
    <html>
    <head>
    <script>
    function m()
    {
    var a="Happy New Year";
    alert(a);
    }
    </script>
    </head>
    <body onload="m()">
    </body>
    </html>
    File 2.htm with the following
    <script>
    // with var a get from var a of file 1.htm
    a=1;
    alert(a);
    </script>

    Can everyone help me ??
    Thanks !!

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,682
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    What is the use-case scenario for this application?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

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