Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hy
I am working on a web page , using the C # language and I intend to do is animate numbers.

My initial problem is the following :
I have a method that generates a number ( 6 digits ) randomly . after I have this number , I want to call a method in javascript that will display this value drawn , but in a lively manner . I want to know how to pass this value drawn as parameter to a javascrip function.
the javascrip code is practically designed , but I want to adapt it to my need . this is an example of the code http://jsfiddle.net/tkG2H/338/[^] , my only problem is through my method " GenerateRandom ( ) " call the function responsible for showing the number on animated form .
this example above , the function is called via the button click . But my need is through the click of the button , call my function " GenerateRandom ( ) " , and it will be responsible for calling the function to display the number , passing as parameter the same value drawn.

any doubts , I can put all the code of my function " GenerateRandom ( ) " .
wait one solution and I thank
Posted

1 solution

Is this what you're looking for?

JavaScript
function Show(value)
{
    var $obj = $("#foo");
    $obj.text(value);
}

function GenerateRandom()
{
    var x = Math.floor(Math.random() * 1000).toString();
    Show(x);
}

$('#go').click(function() {
    GenerateRandom();
});
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900