Posted by Jeff North on 03/10/07 01:02
On Fri, 09 Mar 2007 17:50:48 GMT, in comp.lang.php
andy.z@blueyonder.com
<MPG.205baf093be9d698997d@news-text.blueyonder.co.uk> wrote:
>|
>| I'm confused -
>|
>| The following outputs a URL encoded string into an alert box
>| ----------------------CUT ----------------------
>| function createEmbarrasment() {
>| $tmp = urlencode("Your fly is undone!");
>| ?> <script type="text/javascript"><!--
>| alert('<?php echo $tmp; ?>')
>| //--> </script>
>| <?php
>| }
>| -------------------------------
>| Unfortunately displaying the URL encoded version of the string
>|
Javascript alert boxes are plain text. So if you use
alert("This is line 1<br />This is line 2");
then This is line 1<br />This is line 2 will be displayed
To show the above correctly you need
This is line 1\nThis is line 2
Change your $tmp variable to
$tmp = "Your fly is undone!";
---------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
[Back to original message]
|