[Pro] Random Link Generator in Freeway

Hi everyone

I am thinking of something challenging with FW. Is it possible to create a Random Link Generator in Freeway?

For example, I have 20 external links, which I would like to be drawn randomly and opened in a new window, when someone clicks on a button. I am not sure how do I go about this.

any suggestions?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

The simplest way to do this is with JavaScript. Put all the possible link targets in a structure like an array, then roll the dice at the moment that the button is pressed and use one of them.

The only down-sides to this are that the links are all exposed in the source of your page, and modifying the list of links requires delving into the Page / HTML Markup dialog. As long as neither of those is a show-stopper, I can dig out the code for you.

If you need to obscure where the link goes, or if you need to give your client a nice control panel to change the links, then you’ll need to use a server-side language to do this. Again, your needs drive this decision, so a little more info would be helpful.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Here’s an example of that JavaScript random link:

If you want to use this, simply apply the Protaculous Action to your
page, set the Library picker to prototype-packed, and click on the top
Function Body button and paste in this code. You will need to modify
the following variables: where I have the word myButton, you need to
substitute with the ID of your actual button (or rename your button to
match using the TItle field in the Inspector. Where I have
page_one.html etc., change those to be the actual filenames of your
target pages. If you want these to be external (not relative) URLs,
then you must make those fully-qualified URLs, with http:// and the
full domain and URL.

Walter

On Jul 24, 2011, at 7:30 AM, waltd wrote:

The simplest way to do this is with JavaScript. Put all the possible
link targets in a structure like an array, then roll the dice at the
moment that the button is pressed and use one of them.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks waltd, great info!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options