What i am trying to do may sound kind of complicated but it really isn't. I currently have a form with two buttons (a 'yes' and 'no' button)..I want to run a small piece of javascript (the javascript for facebook share) randomly once out of every 10 times a user clicks yes or no on the form. It seams to me like I could have javascript to randomly display a message once out of every 10 button clicks - but not actually run a piece of javascript code like the facebook share code. Is this possible?
yes. just use a counter variable.. and it's not called running javascript inside javascript it's just javascript.. <button onclick="doThis();">Click!</button> <script type="text/javascript"> var clickCount = 0; function doThis() { clickCount++; if(clickCount >= 10) { // do you thing here... ... clickCount=0; // reset counter } } </script> HTML: