看看这个吧?我没有用过
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/text/html/HTMLDocument.HTMLReader.html
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/text/html/HTMLDocument.HTMLReader.html
解决方案 »
- 不知如何在下载页面下载东西,求哥哥姐姐帮忙
- 一个新手的问题!
- 已二进制方式读取文件并返回给发送者响应的问题(见内)
- 我的一个方法要返回一个String[][] ,但是变量String[][] MyInvokeStr 的实例化在try里面,并且MyInvokeStr 值也是在try里面写入的。我如
- 如何用Java写一个文档抽取工具?(大送分)
- 急!200分!求如何动态将Object转换为指定类型
- 请教关于正则表达式的东西
- 支持Java API Docs中文版
- 我如何用JAVA才能实现文本搜索功能?
- JAVA实现一个类的接口,实际上就是承序这个类,然后在自己的类中重载自己要用的方法?
- 由谁有Magic Draw UML的序列号
- ~~~问个菜问题啊:JRE和Java 2 SDK有什么区别~~~
<html>
<body>
<i id='a'>this is a test</i>
<script language='javascript'>
document.write(document.all.a.innerText);
</script>
</body>
</html>
<!-- TWO STEPS TO INSTALL DOM BROWSER: 1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document --><!-- STEP ONE: Paste this code into the HEAD of your HTML document --><HEAD><SCRIPT LANGUAGE="JavaScript">
<!-- Original: Cyanide_7 ([email protected]) -->
<!-- Web Site: http://www7.ewebcity.com/cyanide7 --><!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com --><!-- Begin
var objects = new Array(), browser = null, expanded = null;// begin objects array with the document
objects[0] = new Array(document, "_document", false);function openDOMBrowser(activeElement){
// finds index of incoming object by its key
activeIndex = arrayIndexOf(objects, activeElement, 1);
// toggles its expanded boolean
objects[activeIndex][2] = !objects[activeIndex][2];
// opens/reopens the window
args = "width=500,height=600,left=20,top=20,scrollbars,resizable,top=0,left=0";
browser = window.open('',"DOMBrowser",args);
browser.focus();
// clears the expanded array (to avoid infinate loops in the DOM)
expanded = new Array();
// document is about to be expanded
expanded["_document"] = true;
// writes HTML to the window
browser.document.open("text/html","replace");
browser.document.writeln("<HTML><HEAD><TITLE>DOM Browser</TITLE></HEAD>");
browser.document.writeln("<BODY BGCOLOR=BBBBBB link=FFFFF vlink=FFFFF>");
browser.document.writeln("<h3>document:</h3><ul>");
// calls recurrsive property writing function
getProps(document);
// finishes writing HTML and closes
browser.document.writeln("</ul></BODY></HTML>");
browser.document.close();
// returns false for event handlers
return false;
}
// recurrsive function to get properties of objects
function getProps(obj){
// for loop to run through properties of incoming object
for(var prop in obj){
browser.document.writeln("<li>");
// if the property is an object itself, but not null...
if(typeof(obj[prop])=="object" && obj[prop]!=null){
// get index of object in objects array
valIndex = arrayIndexOf(objects, obj[prop], 0);
// if not in index array, add it and create its key
if(valIndex==-1){
valIndex = objects.length;
key = ((new Date()).getTime()%10000) + "_" + (Math.floor(Math.random()*10000));
objects[valIndex] = new Array(obj[prop], key, false);
}
// write link for this object to call openDOMBrowser with its key
browser.document.writeln("<b>"+prop+
"</b> : <a href=\"javascript:void(0)\" onClick=\"window.opener.openDOMBrowser('"+
objects[valIndex][1]+"');return false;\">"+(new String(obj[prop])).replace(/</g,"<")+"</a>");
// determine whether object should be expanded/was already expanded
if(objects[valIndex][2] && !expanded[objects[valIndex][1]]){
// if it needs to be expanded, add to expanded array
expanded[objects[valIndex][1]] = true;
// write nested list tag and recurrsive call to getProps
browser.document.writeln("<ul>");
getProps(obj[prop]);
browser.document.writeln("</ul>");
}
} else
// if not an object, just write property, value pair
browser.document.writeln("<b>"+prop+"</b> : " + (new String(obj[prop])).replace(/</g,"<"));
browser.document.writeln("</li>");
}
}
// function to find object in an array by field value
function arrayIndexOf(array, value, field){
var found = false;
var index = 0;
while(!found && index < array.length){
// field may be object reference or key
if(array[index][field]==value)
found = true;
else
index++;
}
return (found)?index:-1;
}
// End -->
</script>
</HEAD><!-- STEP TWO: Copy this code into the BODY of your HTML document --><BODY><center>
<form><input type=button value="Open DOM Browser" onClick="openDOMBrowser('_document');">
</form>
</center><p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p><!-- Script Size: 3.78 KB -->存成html,看看 ------------------------------------------------------
我们还年轻牛奶会有的奶牛也会有的
可天天在 csdn 混这些会有吗 ??
<!-- TWO STEPS TO INSTALL DOM BROWSER: 1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document --><!-- STEP ONE: Paste this code into the HEAD of your HTML document --><HEAD><SCRIPT LANGUAGE="JavaScript">
<!-- Original: Cyanide_7 ([email protected]) -->
<!-- Web Site: http://www7.ewebcity.com/cyanide7 --><!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com --><!-- Begin
var objects = new Array(), browser = null, expanded = null;// begin objects array with the document
objects[0] = new Array(document, "_document", false);function openDOMBrowser(activeElement){
// finds index of incoming object by its key
activeIndex = arrayIndexOf(objects, activeElement, 1);
// toggles its expanded boolean
objects[activeIndex][2] = !objects[activeIndex][2];
// opens/reopens the window
args = "width=500,height=600,left=20,top=20,scrollbars,resizable,top=0,left=0";
browser = window.open('',"DOMBrowser",args);
browser.focus();
// clears the expanded array (to avoid infinate loops in the DOM)
expanded = new Array();
// document is about to be expanded
expanded["_document"] = true;
// writes HTML to the window
browser.document.open("text/html","replace");
browser.document.writeln("<HTML><HEAD><TITLE>DOM Browser</TITLE></HEAD>");
browser.document.writeln("<BODY BGCOLOR=BBBBBB link=FFFFF vlink=FFFFF>");
browser.document.writeln("<h3>document:</h3><ul>");
// calls recurrsive property writing function
getProps(document);
// finishes writing HTML and closes
browser.document.writeln("</ul></BODY></HTML>");
browser.document.close();
// returns false for event handlers
return false;
}
// recurrsive function to get properties of objects
function getProps(obj){
// for loop to run through properties of incoming object
for(var prop in obj){
browser.document.writeln("<li>");
// if the property is an object itself, but not null...
if(typeof(obj[prop])=="object" && obj[prop]!=null){
// get index of object in objects array
valIndex = arrayIndexOf(objects, obj[prop], 0);
// if not in index array, add it and create its key
if(valIndex==-1){
valIndex = objects.length;
key = ((new Date()).getTime()%10000) + "_" + (Math.floor(Math.random()*10000));
objects[valIndex] = new Array(obj[prop], key, false);
}
// write link for this object to call openDOMBrowser with its key
browser.document.writeln("<b>"+prop+
"</b> : <a href=\"javascript:void(0)\" onClick=\"window.opener.openDOMBrowser('"+
objects[valIndex][1]+"');return false;\">"+(new String(obj[prop])).replace(/</g,"<")+"</a>");
// determine whether object should be expanded/was already expanded
if(objects[valIndex][2] && !expanded[objects[valIndex][1]]){
// if it needs to be expanded, add to expanded array
expanded[objects[valIndex][1]] = true;
// write nested list tag and recurrsive call to getProps
browser.document.writeln("<ul>");
getProps(obj[prop]);
browser.document.writeln("</ul>");
}
} else
// if not an object, just write property, value pair
browser.document.writeln("<b>"+prop+"</b> : " + (new String(obj[prop])).replace(/</g,"<"));
browser.document.writeln("</li>");
}
}
// function to find object in an array by field value
function arrayIndexOf(array, value, field){
var found = false;
var index = 0;
while(!found && index < array.length){
// field may be object reference or key
if(array[index][field]==value)
found = true;
else
index++;
}
return (found)?index:-1;
}
// End -->
</script>
</HEAD><!-- STEP TWO: Copy this code into the BODY of your HTML document --><BODY><center>
<form><input type=button value="Open DOM Browser" onClick="openDOMBrowser('_document');">
</form>
</center><p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p><!-- Script Size: 3.78 KB -->存成html,看看 ------------------------------------------------------
我们还年轻牛奶会有的奶牛也会有的
可天天在 csdn 混这些会有吗 ??
我的油箱 [email protected]
你的意思是用xml 和dom
我想做的是在从一个任html文档中提取一对标签间的内容