Jump to content

PHP vs. Java


wattsup88

Recommended Posts

not by the way that your probably thinking...
php is finished processing by the time it hits the browser... however... php can echo out javascript... so you can automate many javascript functions through php... for example...

[code]<?
function status_decrypt($text, $link, $status){
global $statusdecrypt, $head;
if(!isset($statusdecrypt)){
  $statusdecrypt=1;
  $head .='
<SCRIPT LANGUAGE="JavaScript"><!--';
  $head .='var data="0123456789";';
  $head .='var done=1;';
  $head .='function statusIn(text){';
  $head .=' decrypt(text,2,1);';
  $head .='}';
  $head .='function statusOut(){';
  $head .=' self.status = \'\';';
  $head .=' done=1;';
  $head .='}';
  $head .='function decrypt(text, max, delay){';
  $head .=' if(done){';
  $head .='  done=0;';
  $head .='  decrypt_helper(text, max, delay, 0, max);';
  $head .=' }';
  $head .='}';
  $head .='function decrypt_helper(text, runs_left, delay, charvar, max){';
  $head .=' if(!done){';
  $head .='  runs_left = runs_left - 1;';
  $head .='  var status = text.substring(0, charvar);';
  $head .='  for(var current_char = charvar; current_char < text.length; current_char++){';
  $head .='  status += data.charAt(Math.round(Math.random()*data.length));';
  $head .='  }';
  $head .='  window.status=status;';
  $head .='  var rerun = "decrypt_helper(\'" + text + "\'," + runs_left + "," + delay + "," + charvar + "," + max + ");"';
  $head .='  var new_char = charvar + 1;';
  $head .='  var next_char="decrypt_helper(\'" + text + "\'," + max + "," + delay + "," + new_char + "," + max + ");"';
  $head .='  if(runs_left > 0){';
  $head .='  setTimeout(rerun, delay);';
  $head .='  }else{';
  $head .='  if(charvar < text.length){';
  $head .='    setTimeout(next_char, Math.round(delay*(charvar+3)/(charvar+1)));';
  $head .='  }else{';
  $head .='    done=1;';
  $head .='  }';
  $head .='  }';
  $head .=' }';
  $head .='}';
  $head .='--></script>';
}
return '<a href="'.$link.'" onMouseOver="statusIn("'.$status.'");return true;" onMouseOut="statusOut();">'.$text.'</a>';
}
?>[/code]
or to that effect :-)
Link to comment
https://forums.phpfreaks.com/topic/33928-php-vs-java/#findComment-159293
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.