Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Java Script Help Please

  • 26-05-2004 09:27PM
    #1
    Registered Users, Registered Users 2 Posts: 575 ✭✭✭


    Hi all

    I have this

    <!-- <script type="text/javascript" src="http://www.weatherzone.com.au/woys/graphic_current.jsp?postcode=3676&locality=WANGARATTA"></script>--&gt; thats runs a nice weather app on my site

    But what i was wondering was it possible to insert another java script into this java script so that each time my web page loads it changes

    postcode=3676

    to different numbers such as 2000 , 2003 , 2010 , 2390 etc

    and

    locality=Wangartta

    to Sydney , Melbourne , Darwin etc



    Is it possible to have a javascript or some script inside another ?

    regards

    al


Comments

  • Closed Accounts Posts: 102 ✭✭Something


    yes.. and no.. you could achieve that effect by running a javascript outside of that script....

    you could use something like this....
    <script language="JavaScript">
        // some code here to choose the post code
        // into an variable called "postcode" ...
    
        document.write(
            "<script type=\"text/javascript\" +
            " src=\"http://www.weatherzone.com.au/woys/graphic_current.jsp?postcode=" +
            postcode +
            "&locality=WANGARATTA\"></script>";
    </script>
    
    You'll need to write you're own code to choose the postcode because I’m not sure how exactly you want to distinguish between the pages, but this should do the trick. Have fun.


Advertisement