简单的HTML读/写问题 [英] Simple HTML read/write question

查看:77
本文介绍了简单的HTML读/写问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想首先声明我已经搜索了档案

并找到了很多相关资料,但我还是新的足够

javascript我可以还没有适合所有的碎片。所以这是我的

情况。


我想创建一个程序来抓取显示的

网页的来源,将其发送到另一个[外部]程序,然后从其他程序接收

稍微修改后的源代码,然后将稍微修改后的源代码重新发送回原始代码页面。


我希望从这个小组获得的是一些线索。


(1)可以写内容一个网页作为输出

流?

(2)是否有可能完全覆盖网页的源代码

with new source代码?

(3)我可以将这种功能放在书签/ favelet吗?


你能不能给我一些想法?怎么做的。谢谢!!

I would like to first state that I have searched through the archives
and found a lot of related material, but am still new enough to
javascript that I can''t fit all the pieces together yet. So here is my
situation.

I would like to create a program that grabs the source of a displayed
webpage, sends it off to another [external] program, then receive the
slightly modified source back from that other program, and then reposts
the slightly modified source code back to the origonal page.

What I am hoping to get from this group is a few leads.

(1) It is possible to write the contents of a webpage as an output
stream?
(2) Is it possible to completely overwrite the source code of a webpage
with new source code?
(3) Could I put this kind of functionality in a bookmarkelt/favelet?

Could you shoot me a few idea''s as to how this is done. Thanks!!

推荐答案


ch *********** @ gmail.com 写道:

ch***********@gmail.com wrote:
我想首先声明我有通过档案搜索了
并找到了很多相关的资料,但我仍然是新的足够的javascript,我不能把所有的东西放在一起。所以这是我的情况。

我想创建一个程序来抓取显示的网页的来源,将其发送到另一个[外部]程序,然后接收从其他程序稍微修改后的源代码,然后将略微修改后的源代码重新发送回原始页面。


嗨。你为什么要这样做?我将有助于理解

目标。

我希望从这个小组获得的是一些线索。

(1)可以将网页的内容写为输出流吗?


可以使用HTTPRequest对象的

responseText属性将远程网页读入字符串。

( 2)是否可以使用新的源代码完全覆盖网页的源代码?
I would like to first state that I have searched through the archives
and found a lot of related material, but am still new enough to
javascript that I can''t fit all the pieces together yet. So here is my
situation.

I would like to create a program that grabs the source of a displayed
webpage, sends it off to another [external] program, then receive the
slightly modified source back from that other program, and then reposts
the slightly modified source code back to the origonal page.
Hi. Why do you want to do this? I would be helpful to understand the
objective.
What I am hoping to get from this group is a few leads.

(1) It is possible to write the contents of a webpage as an output
stream?
It is possible to read a remote web page into a string using the
responseText property of the HTTPRequest object.
(2) Is it possible to completely overwrite the source code of a webpage
with new source code?



[snip]


您的意思是在远程Web服务器或您当地的机器上覆盖它吗?


如果您的意思是在本地机器上,那么您可以使用

Scriping.FileSystemObject(IE)或XPCOM(Mozilla),用于从Javascript / JScript读取和写入
本地文件。


如果你的意思是在一个你没有控制的远程网络服务器上覆盖它,然后显然没有:想到安全隐患。我/ b $ b假设你不是这个意思。


如果你的意思是在你控制的远程服务器上覆盖它,那么你可以

要么: -


- 使用FTP覆盖文件。 Javascript本身没有FTP

,所以你需要某种形式的组件才能做到这一点。

- 使用ASP,PHP等在该服务器上创建一个网页,可以

从HTTPRequest接收并处理POST请求,并在该服务器上使用文件

保存组件。如果是UNIX服务器,请记住

设置相应的文件访问权限。


Julian


[snip]

Do you mean overwrite it on a remote web server or on your local
machine?

If you mean on your local machine, then you can use
Scriping.FileSystemObject (IE) or XPCOM (Mozilla), to read and write
local files from Javascript/JScript.

If you mean overwite it on a remote web server which you do not
control, then obviously no: think of the security implications. I
assume you don''t mean this.

If you mean overwrite it on a remote server you control, then you could
either:-

- Overwrite the file using FTP. Javascript does not have FTP
natively, so you would need some form of component to do this.
- Create a web page on that server using ASP, PHP etc, that can
receive and process a POST request from an HTTPRequest, and use file
save components on that server. If it is a UNIX server, remember to
set the appropriate file access permissions.

Julian


是的,我想在我的本地机器上覆盖它。


基本概念如下:我想带一个网页

上有一些加密数据。运行我的java脚本......并拥有它

用未加密的数据替换加密数据。


感谢您的帮助

Yes, I would like to overwrite it on my local machine.

The basic concept is the following: I would like to take a webpage that
has some sort of encrypted data on it. Run my java script...and have it
replace the encrypted data with unencrypted data.

Thanks for your help



ch ********* **@gmail.com 写道:

ch***********@gmail.com wrote:
是的,我想在我的本地机器上覆盖它。

基本概念是以下:我想采取一个网页,上面有一些加密数据。运行我的java脚本......并使用未加密的数据替换加密数据。

感谢您的帮助
Yes, I would like to overwrite it on my local machine.

The basic concept is the following: I would like to take a webpage that
has some sort of encrypted data on it. Run my java script...and have it
replace the encrypted data with unencrypted data.

Thanks for your help




你好。在这种情况下,听起来你只需要了解文件

处理IE和Firefox附带的组件。


I.e.我假设你想从你机器上的

给定目录中加载一个网页作为字符串,将其作为字符串处理,然后再次保存

本地计算机。


如上所述,有两组文件处理选项: -


1.对于Internet Explorer


Scripting.FileSystemObject - 一个ActiveX对象。在Microsoft MSDN网站上特别搜索



2.对于Firefox


有负载和保存下页末尾的功能: -

http://www.captain.at/programming/xul/

朱利安



Hi. In which case, it sounds like you just need to learn about file
handling components that ship with IE and Firefox.

I.e. I am assuming that you want to load a web page as a string from a
given directory on your machine, process it as a string, and then save
again on the local computer.

As noted, there are two sets of file handling options available:-

1. For Internet Explorer

Scripting.FileSystemObject - an ActiveX object. Search in particular
on the Microsoft MSDN web site.

2. For Firefox

There are load and save functions at the end of the following page:-

http://www.captain.at/programming/xul/

Julian


这篇关于简单的HTML读/写问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆