Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IDEAS or Solution to Source Code Capture ?

Status
Not open for further replies.

justjim

Programmer
Oct 22, 2002
13
US
Any one have IDEAS or SOLUTION ?

I have a funtion that will return the source code
of a location ... like a HREF ref or a file location
on a hard drive.

When called it will write the source code to a new
window .. typically the default editor's window...
in my case that is NOTEPAD.

I want to redirect this code to a textarea or variable
on the page that calls the function.

or if not possible .... then a way to read and retrieve
the contents of the open NOTEPAD window that contains
the source code of the supplied reference.

Any GREAT Ideas would be appreciated. I have racked my
brain and read HTML and javascript references till I am
crosseyed.

HELP !! THANKS -- Jim


Here is the code :

// ***********************************************
// AUTHOR: LLC
// URL: // Use the script, just leave this message intact.
// Download your FREE CGI/Perl Scripts today!
// ( )
// ***********************************************
function viewSource() {
var test = document.txtHtml.source1.value;
document.location = "view-source:" + test;
}
// ***********************************************

This is the FORM and button i use to call the function :

<form name=&quot;txtHtml&quot;>
<input type=&quot;text&quot; name=&quot;source1&quot; value=&quot;<input type=&quot;button&quot; onClick=&quot;viewSource()&quot; value=&quot;View Source&quot;>
</form>
 
Just a thought:
Using this idea (does it work btw?) -
document.location = &quot;view-source:&quot; + test;

try to open source code into a popup window.
Then get the document contents using DOM and place it into a textarea of parent window.

I didn't try it, this is just an idea for you.
 
Starway ....

The command document.location = &quot;view-source:&quot; + test; opens a
notepad window as a matter of course in its command structure...

i have been unable to open/ retrieve the code in anything else .... and I have
no idea how to extract the contents of the NOTEPAD window using javascript
and DOM ....

Any ideas .... ??

TKX Jim
 
If you cannot move the code source to a browser window, I don't see any sense it trying more: everything is based on it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top