How can i replace string?

How can i replace string?

How can replace string use replace(/;/g, "/") or another that not use split(array)?
ex: ;001;;002;;; -> 001/002 
  1. <script type="text/javascript">
  2.         function test()
  3.         {
  4.           var row=$('table tr');
  5.           var temp=[];                   
  6.           $(row).each(function(){          
  7.             var col=$(this).find('td');           
  8.             var tdtext="";
  9.             $(col).each(function(){
  10.                 var _txt=[];
  11.                 temp=$(this).text().split(';');
  12.                 $(temp).each(function(i){
  13.                    if(temp[i]!="")
  14.                    {
  15.                         _txt.push(temp[i]);                       
  16.                    }
  17.                 });                                
  18.                 $(_txt).each(function(i){
  19.                     tdtext+=_txt[i]+"/";                                                           
  20.                 });                
  21.                 $(this).text(tdtext);
  22.             });            
  23.           });
  24.         }         
  25.         $(document).ready(function(){ 
  26.             test();           
  27.         });                     
  28. </script>
Mr Lam