Cannot create link with document.write

I have a html file like the below, that calls a php file

[code]

[/code]

In the php file I just want to create a link, but I only get simple text.
The php file is the following

<?php echo 'document.write("<a href=\"http://google.com\" target=\"_blank\">Bring me to google</a>")'; ?>

Try putting this line at the top of the PHP file:

[php]header(“content-type: application/x-javascript”);[/php]

No use.
You can try it at home, there are only 2 files. Very strange behavior.

Works fine for me - go to the php file and see what that’s outputting, and (if you’re using firefox) you can also go back to the main page, select all, then right click and view selection source

Yes, it is working fine. It should be some strange char.
Firefox showed
<a href=“http: xmlns=“http://www.w3.org/1999/xhtml” “=””
I still cannot find that strange char.

Sponsor our Newsletter | Privacy Policy | Terms of Service