易截截图软件、单文件、免安装、纯绿色、仅160KB

使用python获取html页面的内容

import urllib
from HTMLParser import HTMLParser
class TitleParser(HTMLParser):
def __init__(self):
self.title = ''
self.divcontent = ''
self.readingtitle = 0
self.readingdiv = 0
HTMLParser.__init__(self)
def handle_starttag(self, tag, attrs):
if tag == 'title':
self.readingtitle = 1
if -1 != tag.find("div"):
self.readingdiv = 1
def handle_data(self, data):
if self.readingtitle:
# Ordinarily, this is slow and a bad practice, but
# we can get away with it because a title is usually
# small and simple.
self.title += data
if self.readingdiv:
self.divcontent += data
def handle_endtag(self, tag):
if tag == 'title':
self.readingtitle = 0
if tag == "div":
self.readingdiv = 0
def gettitle(self):
return self.title
def getdiv(self):
return self.divcontent
def getweb(url):
web = urllib.urlopen('http://blog.chinaunix.net/u3/105068/showart_2223566.html').read()
return web
web = getweb('http://blog.chinaunix.net/u3/105068/showart_2223566.html')
test = TitleParser()
test.feed(web)
file_object = open('abinfile', 'w')
file_object.write(test.title)
file_object.write("\r\n")
file_object.write(test.divcontent)
file_object.close()


相关文档:

HTML播放视频

1.avi格式
代码片断如下:
<object id="video" width="400" height="200" border="0" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA">
<param name="ShowDisplay" value="0">
<param name="ShowControls" value="1">
<param name="AutoStart" value="1">
<param name="Auto ......

使用createElement动态创建HTML对象

<script language="javascript">
var o = document.body;
//创建表格
function createTable(w,h,r,c)
{
var table = document.createElement("table");
var tbody = document.createElement("tbody");
table.width = w;
table.height = h;
table.border = 1;
for(var i=1;i<=r; ......

asp.net结合html,javascript实现无刷新跨域数据提交

需求:
A域有页面a.html,其中有iframe包含B域的页面b.html,现在要通过a.html上的一个按钮,来把a.html页面上一个文本框的值传递到b.html页面的文本框。
注:这里b.html是html网页,不能接收其他网站post过来的值,所以不能用直接post的方法来传值,但是,如果接收页面是b.aspx或者b.asp 呢,那不是可以直接post了么?答 ......

你真的知道一个HTML及资源是如何load的吗?

 
你真的知道一个HTML及资源是如何load的吗(了解各个部分是何时下载和执行的)
原文地址:http://www.cnblogs.com/mindsbook/archive/2009/12/03/sequence_of_response.html
本博客所有内容采用 Creative Commons Licenses 许可使用. 引用本内容时,请保留 朱涛, 出处 ,并且 非商业& ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号