0 Replies Latest reply on Apr 14, 2011 9:35 AM by Ajit Singh

    Audio Captcha code required

    Ajit Singh Newbie

      Hi, Can anybody tell me how to implement audio captcha using richfaces and jsf.  I have already implemented captcha but now I want to implement audio functionality for visually challanged people. There should be a sound icon on click of which it should read out the captcha text generated dynamically everytime.

                                               I got a java script code which is incomplete and I didnt understand completely as how to call this function.Code:

       

      <body bgcolor="lightblue" onload="Init()">

         <script  language="JavaScript">

       

         function Init(){

         document.getElementById('userAnswer').value="";

         }

         var onWindows=true;

         var onExplorer=true;

         if(navigator.platform.indexOf("win")==-1)

         {

         onWindows=false;

         }

         if(navigator.appName !="Microsoft Internet Explorer")

         {

            onExplorer=false;

         }

       

         // grab user key press//

       

         document.onkeyup=KeyCheck;

         function KeyCheck(e)

         {

         var keyPressed=(window.event) ? event.keyCode:e.keyCode;

         var hotKey=80;//p key

       

         if(keyPressed==hotKey)

         {

         document.getElementById('userAnswer').value=" ";

       

         if(onWindows and  onExplorer)

         {

         document.getElementById('mediaPlayer').controls.play();

         }

         else

         {

         document.getElementById('writeHere').innerHTML=

         '<iframe src="./playSound.php" width="0" height="0"></iframe>';

         }

         document.getElementById('userAnswer').focus();

         }

       

         }

        /* if using IE on windows then use embeded window media player*/

       

       

       

       

       

         </script>