<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/htmlcharset=utf-8">
<title>无标题文档</title>
<script src="jquery-1.9.1.min.js"></script>
</head>
<body>
<div id="btn">用力点</div>
<script>
$('#btn').click(function(){
$.ajax({
type: "POST",
url: "dom.php", //提价处理的PHP,你也可以是其他处理程序
data: "keyword=HelloWorld", //提交的数据
success: function(msg){
alert( "Data Saved: " + msg )//返回信息 msg 是dom.php renturn 的返回值
}
})
})
</script>
</body>
</html>
<!DOCTYPE HTML><html>
<head>
<meta charset="UTF-8">
<title>Droid</title>
<style type="text/css">
ul li {
float: left
list-style: none
padding-right: 10px
}
</style>
<script type="text/javascript" src="jquery-1.8.0.min.js"></script>
<script type="text/javascript">
$ (function ()
{
var oUll = $ ("#ul"), FR, source = $ (':file')
if (!!(FR = $ (window).prop ('FileReader')))
{
var fr = new FR ()
$ ("#btn").click (function ()
{
var file = source.prop ('files')[0]
if (!file)
{
return false
}
var aLi = $ ("<li></li>")
var aImg = $ ("<img />")
oUll.append (aLi)
aLi.append (aImg)
var imgs = $ ("img")
fr.onloadend = function (e)
{
imgs.eq (imgs.length - 1).attr ('src', e.target.result)
source.val ('')
}
fr.readAsDataURL (file)
})
}
})
</script>
</head>
<body>
<input type="file" name="file" />
<input id="btn" type="button" value="添加" />
<ul id="ul"></ul>
</body>
</html>
1、首先用java生成txt文件有有两种方式,一种是通过字符流(或字节流),另一种是直接调用PrintWriter类。字符流(字节流)代码如下:import java.io.Fileimport java.io。
2、FileOutputStreampublic class TxtWirte { public void DOWriteTxt(String file, String txt) { try { FileOutputStream os = new FileOutputStream(new File(file), true) 。
3、os.write((txt + "\n").getBytes()) } catch (Exception e) { e.printStackTrace() } } public static void main(String[] args) { new TxtWirte().DOWriteTxt("D:\\问好.txt", "你好!")}}。
4、调用PrintWriter类:import java.io.*public class C { public static void main( String[ ] args ) throws Exception { PrintWriter pw = new PrintWriter( new FileWriter( "D\\问好.txt" ) )。
5、pw.print("你好" )pw.close()}}如果要生成doc文件,将“D:\\问好.txt”改成“D:\\问好.doc”即可。的:java写一定内容到指定路径的文件中程序源码。
6、最后循环控制变 FileOutputStream outfile=null //文档输出对 //生成对象outfile。就完成了。