Assume my homepage has a button and a textbox. When I press the button, the textbox would show the page source code of "www.google.com" (or any other web page source code) Of course, I haven't got the page source code before hand, or else I can just copy and paste the page source code to the textbox... Would you please tell me how to use javascript to do that? Thank you very much for helping me^^ May I ask a further question... How about if I only want the first 100 charcters or the first 15 lines of the source code to be in my textbox? How would I do that with javascript?
You need to write a php script to access the third party page using fopen and echo the result to the screen (a very simple task). Then write an ajax application to call the php script and display the resulting output into your text area. Its pretty simple to do.
You can get the code with the JavaScript Source's source viewer. How to put it in the textbox - or manipulate it otherwise - is a matter of programming. They have lots of great snippets.
You even don't need ajax, if you allow to refresh page when someone type url. Nutshell from brain: $code = file_get_content("url"); <textarea><?=$code?></textarea> Just pseudocode...
Bummer... I have used it a few times as a template filling pagebuilder - check off menus, footers, and etc. - input the title, desc, kw, location of a content file, and via a simple cgi or php script up pops a cut and paste html page... chengcj also mentioned Google. With the javascript, the request is by the user, not the script (in its basic form).
Thank you very much every body! But may I further ask another question... How about if I don't want the entire source code? I would only want the first 100 characters of the source code to be in my textbox....
using ajax will be safer for you, but not sure if it wont be browser security restrictions for loading different domain's data...
The view-source protocol was disabled in Internet Explorer 6 for Windows XP when Service Pack 2 was released. http://support.microsoft.com/default.aspx?scid=kb;en-us;904678
Here is the basic implementation of what I mentioned earlier... http //www netmidwest.com/source.html I found it handy for seeing what was in mouseover or 0 second redirects, too. I wonder what the logic was for disabling it.