php文件上传及头像预览
<meta http-equiv="Content-Type" content="text/html; " /><title>无标题文档</title>
<style type="text/css">
#yl{>
#file{>
</style>
</head>
<body>
<form action="chuli.php" method="post" enctype="multipart/form-data" target="shangchuan">
<input type="hidden" name="tp" value="" />
<div>
<input type="file" name="file" onchange="document.getElementById('sc').submit()" />
</div>
</form>
<iframe name="shangchuan">
</iframe>
</body>
<script type="text/javascript">
//回调函数,调用该方法传一个文件路径,该变背景图
function showimg(url)
{
var div = document.getElementById("yl");
div.style.backgroundImage = "url("+url+")";
document.getElementById("tp").value = url;
}
</script>
</html>
页:
[1]