There is a particular reason for the random page.
What is that reason?
Printable View
There is a particular reason for the random page.
What is that reason?
Siran, I have added to your example with links to other website pages: Attachment 112700
Any click on the image on the page picks test1.htm / test2.htm; only the Home button returns to the index.htm page.
Acorn
I can follow a lot of this but what always trips me up is how to intergrate js within Xara placeholders or buttons.
For example here is a nice script that sets up an array of url's that uses the length of the array to set up the number of url options.
How would this be intergrated into a Xara page?
Quote:
Source:
http://stackoverflow.com/questions/3...andom-redirect
var sites = [
'http://www.dilbert.com',
'http://stackoverflow.com',
'http://Starwars.com'
];
var target = Math.floor(Math.random() sites.length);
window.location = sites[target];
So when your site collection grows you don't need to alter the code. You could even pack it into a function:
function goRandomSite(sites) {
var target = Math.floor(Math.random() sites.length);
window.location = sites[target];
}
Egg, in this example you could put
to the page HTML code (head) and then would use a link like thisCode:<script>
function goRandomSite(sites) {
var target = Math.floor(Math.random()*sites.length);
window.location = sites[target];
}
</script>
Please note that in your example the multiplication character is missing.Code:javascript:goRandomSite(["http://www.dilbert.com","http://stackoverflow.com","http://Starwars.com"]);
Thanks a lot for that Siran, that worked a treat.
I'd love to know how to do a random pop-up layer, working on a dice roll animation that also goes to a web-page correlated to the number rolled
press button, pop-up shows your roll then opens your web-page (36 pages possible)...