Forum Moderators: DixonJones
Is there a simple line of code that I can put on a page that will load page A the first time someone views it, and load page B the second time someone views it, and load page A the third time someone views it, and load page B the fourth time someone uses it, and load page A the fifth, Page B the sixth, and so on?
Isn't there some simple HTML for this? Or a basic cut and past JavaScript?
I haven't found it anywhere... lots of pay services. I have an ebook that I want to split test two pages, to see which gets higher return rates, but everything I've found so far has been pay for services, or not very helpful.
Any responses much appreciated!
The best you could probably achieve with JavaScript it for it to throw a random number so that you get a 50%/50% split, and that the JavaScript then writes the appropriate contents with document.write() statements. I wouldn't recomend this approach.
Also when you say "someone" do you mean the same person revisiting the page, or anyone?
What would a Javascript look like for this? I can use the other programming languages with my host, but I'm not good with them personally at present.
Why wouldn't you recommend a document.write code?
It would also be harder code to maintain and debug.
Javascript would look something like.
<script type="text/javascript">
...
if ( parameter == 1) {
document.write('html code 1a');
document.write('html code 1b');
document.write( html code 1c);
} else {
document.write('html code 2a');
document.write('html code 2b');
document.write('html code 2c');
}
</script>
Whereas in PHP for example you could just have
<? if ( $paramater == 1 ) {?>
html code 1 here
<? } else {?>
html code 2 here
<? } ?>