Hi,
I am having a little trouble displaying a variable that's created in a function. I am using an onclick to pass a value from 1-4 depending on the link clicked. I have made the function check to see if the value is 1-4 then created 4 variations of the same variable. So:
if(a=1){
para='text';
}
if(a=2){
para='text';
}
etc
I want to be able to output the value of para anywhere I choose in my html. At the moment I am trying to output the variable in a div using document.write. I have set the variable para outside of the function to make it global, but it still does not work. I know the variable is working inside the function as i have tested it with alert to make sure I'm getting the right value.
any help on this would be great
Cheers
Rob
I am having a little trouble displaying a variable that's created in a function. I am using an onclick to pass a value from 1-4 depending on the link clicked. I have made the function check to see if the value is 1-4 then created 4 variations of the same variable. So:
if(a=1){
para='text';
}
if(a=2){
para='text';
}
etc
I want to be able to output the value of para anywhere I choose in my html. At the moment I am trying to output the variable in a div using document.write. I have set the variable para outside of the function to make it global, but it still does not work. I know the variable is working inside the function as i have tested it with alert to make sure I'm getting the right value.
any help on this would be great
Cheers
Rob