I have a php file generating output using data retrieved from Mysql, I need to get the source of the output file into a textarea on the page. I tried using the javascript code but it wouldn't work. Here's the part ------- <textarea name="mysource"></textarea> <input type="button" value="Get Source" onclick="mysource.value='view-source:' + window.location"> ------- Any help will be welcome..
Hi, you have at least two options: 1. enclose your code with <form> tag - then you may refer to textarea by its name 2. add id parameter and rewrite the event : <textarea name="mysource" id="mysource"></textarea> <input type="button" value="Get Source" onclick="document.getElementById('mysource').value='view-source:' + window.location"> HTML:
I have enclosed the textarea in the <form> tag but the main prob is - 'view-source:' + window.location is not working, not even on the address bar of the browser.
The piece of code works fine, it shows the url of current window inside textarea. If you want to show HTML source of some page, then you could appreciate AJAX call.