87,921
社区成员
发帖
与我相关
我的任务
分享
<a href="javascript:;" ondblclick="javascript:loadfile()" title="双击上传/更改照片" runat="server" id="uploadBUTTON">双击上传图片</a>
<input type="file" name="item11" onchange="javascript:getEffect()" style=" display:none" id="item11" />
<script type="text/javascript">
function loadfile() {
o("item11").click();
}
function getEffect() {
var fileobj = o("item11");
var filepath = "";
//alert(window.navigator.userAgent.toUpperCase());
if (window.ActiveXObject && document.all) {
filepath = fileobj.value;
//fileobj.lang = filepath;
//alert(filepath);
/*
if (navigator.userAgent.indexOf("MSIE 6.0") == -1) {
fileobj.style.display = "block";
fileobj.select();
filepath = document.selection.createRange().text;
fileobj.style.display = "none";
}
else {
alert("not ie6");
}
*/
//fileobj.style.display = "block";
google(filepath);
}
else {
var file = o("item11").files[0];
var reader = new FileReader();
reader.onload = function (e) {
//var pic = document.getElementById("preview");
filepath = e.target.result;
google(filepath);
}
reader.readAsDataURL(file);
/*
var fileobj = o("item8").files[0];
try { //火狐7.0以后
filepath = window.URL.createObjectURL(fileobj);
} catch (e) {
filepath = fileobj.getAsDataURL();
}
*/
}
}
function google(filepath) {
o("uploadBUTTON").innerHTML = "<img src='" + filepath + "' width='812' />";
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<br />
<br />
<div style="border: solid 1px red; width: 812px; height: 600px" id="rongqi">
<a runat="server" id="uploadBUTTON">双击上传幼儿在幼儿园运动照片(教师上传)</a>
<div style="width: 400px; height: 300px; overflow: hidden; position: absolute; filter: alpha(opacity=50);
-moz-opacity: 0.5; opacity: 0.5;" id="uploadfilediv11">
<input type="file" name="item11" onclick="return false" onchange="javascript:getEffect()"
style="filter: alpha(opacity=50); -moz-opacity: 0.5; opacity: 0.5; display: block;
border: solid 1px red; font-size: 10000px;" id="item11" />
</div>
<input type="hidden" runat="server" id="uploadfilehidden" value="" />
<script type="text/javascript">
var fileConfig = new Array("rongqi", "uploadBUTTON", "uploadfilediv11", "item11", "effectImage1", "812", "600");
google(o("uploadfilehidden").value);
function getEffect() {
var fileobj = o(fileConfig[3]);
var filepath = "";
if (window.ActiveXObject && document.all) {
filepath = fileobj.value;
google(filepath);
}
else {
var file = o(fileConfig[3]).files[0];
var reader = new FileReader();
reader.onload = function (e) {
filepath = e.target.result;
google(filepath);
}
reader.readAsDataURL(file);
}
}
function google(filepath) {
var iw = parseInt(fileConfig[6]);
var ih = parseInt(fileConfig[7]);
if (filepath.length > 0) {
o(fileConfig[1]).innerHTML = "<img src='" + filepath + "' id='" + fileConfig[4] + "' style='width:812px' />";
o(fileConfig[4]).onload = function () {
var w2 = iw;
var w = o(fileConfig[4]).width;
var h = o(fileConfig[4]).height;
var h2 = h / w * iw;
o(fileConfig[3]).style.width = w2 + 'px';
o(fileConfig[3]).style.height = h2 + 'px';
o(fileConfig[2]).style.height = h2 + 'px';
o(fileConfig[2]).style.width = w2 + 'px';
var xy = getpos(o(fileConfig[0])).split(",");
o(fileConfig[2]).style.left = xy[0] + "px";
o(fileConfig[2]).style.top = xy[1] + "px";
}
}
else {
var w2 = iw;
var h2 = ih;
o(fileConfig[3]).style.width = iw + 'px';
o(fileConfig[3]).style.height = ih + 'px';
o(fileConfig[2]).style.height = h2 + 'px';
o(fileConfig[2]).style.width = w2 + 'px';
var xy = getpos(o(fileConfig[0])).split(",");
o(fileConfig[2]).style.left = xy[0] + "px";
o(fileConfig[2]).style.top = xy[1] + "px";
}
}
function o(str) {
return document.getElementById(str);
}
function getpos(e) {
var t = e.offsetTop;
var l = e.offsetLeft;
var height = e.offsetHeight;
while (e = e.offsetParent) {
t += e.offsetTop;
l += e.offsetLeft;
}
return l + "," + t;
}
</script>
</div>
</body>
</html>
<div style="border: solid 1px red; width: 812px; height: 600px" id="rongqi">
<a runat="server" id="uploadBUTTON">双击上传幼儿在幼儿园运动照片(教师上传)</a>
<div style="width: 400px; height: 300px; overflow: hidden; position: absolute;filter: alpha(opacity=50); -moz-opacity: 0.5; opacity: 0.5;" id="uploadfilediv11">
<input type="file" name="item11" onclick="return false" onchange="javascript:getEffect()" style="filter: alpha(opacity=50);
-moz-opacity: 0.5; opacity: 0.5; display: block; border: solid 1px red; font-size: 10000px;"
id="item11" />
</div>
<input type="hidden" runat="server" id="uploadfilehidden" value="" />
<script type="text/javascript">
var fileConfig = new Array("rongqi", "uploadBUTTON", "uploadfilediv11", "item11", "effectImage1");
google(o("uploadfilehidden").value);
function getEffect() {
var fileobj = o(fileConfig[3]);
var filepath = "";
if (window.ActiveXObject && document.all) {
filepath = fileobj.value;
google(filepath);
}
else {
var file = o(fileConfig[3]).files[0];
var reader = new FileReader();
reader.onload = function (e) {
filepath = e.target.result;
google(filepath);
}
reader.readAsDataURL(file);
}
}
function google(filepath) {
var iw = 812;
var ih = 600;
if (filepath.length > 0) {
o(fileConfig[1]).innerHTML = "<img src='" + filepath + "' id='" + fileConfig[4] + "' style='width:812px' />";
o(fileConfig[4]).onload = function () {
var w2 = iw;
var w = o(fileConfig[4]).width;
var h = o(fileConfig[4]).height;
var h2 = h / w * iw;
o(fileConfig[3]).style.width = w2 + 'px';
o(fileConfig[3]).style.height = h2 + 'px';
o(fileConfig[2]).style.height = h2 + 'px';
o(fileConfig[2]).style.width = w2 + 'px';
var xy = getpos(o(fileConfig[0])).split(",");
o(fileConfig[2]).style.left = xy[0] + "px";
o(fileConfig[2]).style.top = xy[1] + "px";
}
}
else {
var w2 = iw;
var h2 = ih;
o(fileConfig[3]).style.width = iw + 'px';
o(fileConfig[3]).style.height = ih + 'px';
o(fileConfig[2]).style.height = h2 + 'px';
o(fileConfig[2]).style.width = w2 + 'px';
var xy = getpos(o(fileConfig[0])).split(",");
o(fileConfig[2]).style.left = xy[0] + "px";
o(fileConfig[2]).style.top = xy[1] + "px";
}
}
function o(str) {
return document.getElementById(str);
}
function getpos(e) {
var t = e.offsetTop;
var l = e.offsetLeft;
var height = e.offsetHeight;
while (e = e.offsetParent) {
t += e.offsetTop;
l += e.offsetLeft;
}
return l + "," + t;
}
</script>
</div>
<a href="javascript:;" ondblclick="javascript:loadfile()" title="双击上传/更改照片" runat="server" id="uploadBUTTON">双击上传幼儿在幼儿园运动照片(教师上传)</a>
<input type="file" name="item11" onchange="javascript:getEffect()" style=" display:none" id="item11" />
<script type="text/javascript">
function loadfile() {
o("item11").click();
}
function getEffect() {
var fileobj = o("item11");
var filepath = "";
//alert(window.navigator.userAgent.toUpperCase());
if (window.ActiveXObject && document.all) {
filepath = fileobj.value;
//fileobj.lang = filepath;
//alert(filepath);
/*
if (navigator.userAgent.indexOf("MSIE 6.0") == -1) {
fileobj.style.display = "block";
fileobj.select();
filepath = document.selection.createRange().text;
fileobj.style.display = "none";
}
else {
alert("not ie6");
}
*/
//fileobj.style.display = "block";
google(filepath);
}
else {
var file = o("item11").files[0];
var reader = new FileReader();
reader.onload = function (e) {
//var pic = document.getElementById("preview");
filepath = e.target.result;
google(filepath);
}
reader.readAsDataURL(file);
/*
var fileobj = o("item8").files[0];
try { //火狐7.0以后
filepath = window.URL.createObjectURL(fileobj);
} catch (e) {
filepath = fileobj.getAsDataURL();
}
*/
}
}
function google(filepath) {
o("uploadBUTTON").innerHTML = "<img src='" + filepath + "' width='812' />";
}
</script>