This is a code how to make random input in imacros for 1 input{{fruit}} I need to know how can I make 3 inputs random like {{fruit2}} {{fruit3}} {{fruit3}}
PHP Code:
myfruits = new Array(); myfruits.push("Strawberry"); myfruits.push("Banana"); myfruits.push("Kiwi"); myfruits.push("Orange"); myfruits.push("Mango");
Assuning 1,2 and 3 have to be different: set fruit2 = fruit and then loop while fruit2 == fruit, calling the randomiser. Set fruit3 = fruit and then loop while fruit3 == fruit OR frui3 == fruit2
myfruits = new Array();
myfruits.push("Strawberry");
myfruits.push("Banana");
myfruits.push("Kiwi");
myfruits.push("Orange");
myfruits.push("Mango");
function getFruit() {
for(i=0;i<10;i++)
{
randomint = Math.floor(Math.random()*myfruits.length);
return myfruits[randomint]'
}
to use -
HTML Code:
response.write(getFruit()):
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
myfruits = new Array();
myfruits.push("Strawberry");
myfruits.push("Banana");
myfruits.push("Kiwi");
myfruits.push("Orange");
myfruits.push("Mango");
function getFruit() {
for(i=0;i<10;i++)
{
randomint = Math.floor(Math.random()*myfruits.length);
return myfruits[randomint]'
iimSet("fruit",myfruits[randomint]); //in the macro you can access the random fruit through {{fruit}} much like you would {{!VAR1}}
iimPlay("fruit.iim");
}
and I have error SyntaxError: return not in function, line: 19
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
Sorry, not work she give me __undefined__
fruit.iim
Code:
TAG POS=1 TYPE=INPUT:TEXT FORM=* ATTR=ID:* CONTENT={{fruit}}
TAG POS=2 TYPE=INPUT:TEXT FORM=* ATTR=ID:* CONTENT={{fruit2}}
fruit.js
Code:
var myfruits = new Array();
myfruits = new Array();
myfruits.push("Strawberry");
myfruits.push("Banana");
myfruits.push("Kiwi");
myfruits.push("Orange");
myfruits.push("Mango");
function getFruit() {
for(i=0;i<10;i++)
{
randomint = Math.floor(Math.random()*myfruits.length);
}
return myfruits[randomint];
iimSet("fruit",myfruits[randomint]); //in the macro you can access the random fruit through {{fruit}} much like you would {{!VAR1}}
iimPlay("fruit.iim");
}