Random window.open

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wayne

    Random window.open

    Hi,

    I would like to know if there is a way in php to randomize
    the following url (www.domainsample.com used as example).

    I have 4 different urls I would like to use, basically changing
    every time the page is accessed.

    <!--
    function open_on_entranc e(url,name)
    {

    new_window = window.open('ww w.domainsample. com','domainsam ple',
    'menubar,resiza ble,scrollbars, dependent,statu s')
    }
    // -->
    </script>

    Any assistance would be great.

    --
    Thanks,

    Wayne.


  • Jerry Stuckle

    #2
    Re: Random window.open

    Wayne wrote:[color=blue]
    > Hi,
    >
    > I would like to know if there is a way in php to randomize
    > the following url (www.domainsample.com used as example).
    >
    > I have 4 different urls I would like to use, basically changing
    > every time the page is accessed.
    >
    > <!--
    > function open_on_entranc e(url,name)
    > {
    >
    > new_window = window.open('ww w.domainsample. com','domainsam ple',
    > 'menubar,resiza ble,scrollbars, dependent,statu s')
    > }
    > // -->
    > </script>
    >
    > Any assistance would be great.
    >[/color]

    I'm not sure what your question is. You ask if you can do something in PHP,
    then post some javascript code.

    If you're asking if you can generate the javascript code with randomized urls,
    the answer is yes - put the url's you want to randomize in an array, call rand()
    to get a random number between 0 and the number of array elements - 1 and write
    the selected element into your javascript code.

    And BTW - when using example domains, you should use www.example.com - which has
    been reserved for that reason.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    Working...