codierung über php an js...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • codierung über php an js...

    hallo,

    ich brauch mal wieder hilfe.

    wie kann ich strings so im php so codieren, dass sie als hexadezimale
    werte in javascript übergeben werden können?

    z.B.
    stefan

    sollte so ausgegeben werden:

    document.write(unescape("%53%74%65%66%61%6E"));


    mit urlencode() und rawurlencode() komm ich irgendwie
    nicht zu potte.

    thx
    Kissolino.com

  • #2
    Und wozu braucht man so was??

    bestimmt zu komliziert, aber geht!!

    PHP Code:
    <script type="text/javascript" language="Javascript">
    <!--
    <?php
    $txt 
    "Orestes";
    for (
    $i 0$i strlen($txt); $i++) {
        
    $une .= "%".dechex(ord(substr($txt$i1)));
    }
    ?>
    document.write(unescape("<?php echo $une?>"));
    //-->
    </script>
    Orestes
    Risc is part of the game if you want to sit in the captain´s chair.

    Comment

    Working...
    X