梦想年华之 先提交的 图片上传(使用eWebEditor自带的网页对话框)

news/2024/7/4 23:10:34 标签: function, javascript, input, button, border, url

先提交的 图片上传 (使用ewebeditor中的Img.htm )

ewebeditor 要使用的文件有 buttonimage css dialog indude sysimage UploadFile   文件夹 WEB-INF/Buttom.xml WEB-INF/Style.xml 根目录下 upload.jsp 和 eWebEditor.jsp

Img.jsp

<!--这个源码来自[Code佳源码-http://Codejia.Com],需要更多源码请访问http://Codejia.Com-->
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<style type="text/css">
body, a, table, div, span, td, th, input, select{font:9pt;font-family: "宋体", Verdana, Arial, Helvetica, sans-serif;}
body {padding:5px}
</style>
<script language="JavaScript" src="../dialog/dialog.js"></script>
<script language="JavaScript" src="js/news.js"></script>
<BODY bgColor=menu οnlοad="InitDocument()">
<table border=0 cellpadding=0 cellspacing=0 align=center>
<tr>
 <td>
   <fieldset>
      <legend>图片来源</legend>
      <table border=0 cellpadding=0 cellspacing=0>
        <tr>
          <td colspan=9 height=5></td>
        </tr>
        <tr>
          <td width=7></td>
          <td width=54 align=right οnclick="RadioClick('file')"><input type=radio id="d_checkfromfile" value="1" οnclick="RadioClick('file')">上传:</td>
          <td width=5></td>
          <td colspan=5>
         <Script Language=JavaScript>
    document.write('<iframe id=d_file frameborder=0   src="../upload.jsp?type=image&style=CoolBlue"  width="100%"  height="22" scrolling=no></iframe>');
   </Script>
          </td>
          <td width=7></td>
        </tr>
        <tr>
          <td colspan=9 height=5></td>
        </tr>
        <tr>
          <td width=7></td>
          <td width=54 align=right οnclick="RadioClick('url')"><input type=radio id="d_checkfromurl" value="1" οnclick="RadioClick('url')">网络:</td>
          <td width=5></td>
          <td colspan=5><input name="text" type=text id="d_fromurl" style="width:243px" value="" size=30></td>
          <td width=7></td>
        </tr>
        <tr>
          <td colspan=9 height=5></td>
        </tr>
      </table>
    </fieldset></td>
</tr>
<tr><td height=5></td></tr>
<tr><td align=right><input type=submit value='确定' id=Ok οnclick="ok()">&nbsp;&nbsp;<input type=button value='取消' οnclick="window.close();"></td></tr>
</table>
<div id=divProcessing style="width:200px;height:30px;position:absolute;left:70px;top:20px;display:none">
<table border=0 cellpadding=0 cellspacing=1 bgcolor="#000000" width="100%" height="100%"><tr><td bgcolor=#3A6EA5><marquee align="middle" behavior="alternate" scrollamount="5"><font color=#FFFFFF>...图片上传中...请等待...</font></marquee></td></tr></table>
</div>
</body>
</html>
<span style="display:none;">这个源码来自http://Codejia.Com,更多源码请访问<a href="http://Codejia.Com">http://Codejia.Com</a>&nbsp;<a href="http://9host.cn">虚拟主机</a>&nbsp;<a href="http://15883.com">免费域名</a>&nbsp;<a href="http://bestmoban.com">网页模版</a></span>




news.js

var sFromUrl = "http://";





// 初始值

function InitDocument(){

	d_fromurl.value = sFromUrl;

	RadioClick('file');

}



// 图片来源单选点击事件

function RadioClick(what){

	if (what=="url"){

		d_checkfromfile.checked=false;

		d_fromurl.disabled=false;

		d_checkfromurl.checked=true;

		d_file.myform.uploadfile.disabled=true;

	}else{

		d_checkfromurl.checked=false;

		d_file.myform.uploadfile.disabled=false;

		d_checkfromfile.checked=true;

		d_fromurl.disabled=true;

	}

}





// 上传错误

function UploadError(sErrDesc){

	AbleItems();

	RadioClick('file');

	divProcessing.style.display="none";

	try {

		BaseAlert(d_file.myform.uploadfile,sErrDesc);

	}

	catch(e){}

}





// 文件上传完成时执行,带入上传文件名

function UploadSaved(sFileName){

	d_fromurl.value=GetHttpUrl("UploadFile/"+sFileName);

	ReturnValue();

}



// 本窗口返回值

function ReturnValue(){

	sFromUrl = d_fromurl.value;

	window.returnValue = sFromUrl;

	window.close();

}





// 点确定时执行

function ok(){

	// 上传文件判断

	if (d_checkfromurl.checked){

		// 返回值

		ReturnValue();

	}

	else

	{

		if (!d_file.CheckUploadForm()) return false;

		// 使各输入框无效

		DisableItems();

		// 显示正在上传图片

		divProcessing.style.display="";

		// 上传表单提交

		d_file.myform.submit();

	}

}



// 使所有输入框无效

function DisableItems(){

	d_checkfromfile.disabled=true;

	d_checkfromurl.disabled=true;

	d_fromurl.disabled=true;

	Ok.disabled=true;

}



// 使所有输入框有效

function AbleItems(){

	d_checkfromfile.disabled=false;

	d_checkfromurl.disabled=false;

	d_fromurl.disabled=false;

	Ok.disabled=false;

}





// 显示无模式对话框

function ShowDialog(url, width, height) {

	var arr = window.showModalDialog(url,window,"dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:no;status:no");

	return arr;

}



//添加上传图片事件

function getPicture()

{

	var sPicture = ShowDialog('Img.htm',350,140)

	if(sPicture!=null)

	{

		document.AddNews.NewsPicture.value = sPicture;

	}

}



 实现页 add.jsp

<script type="text/javascript">

 function checkspace(checkstr) {

  var str = '';

  for(i = 0; i < checkstr.length; i++) {

    str = str + ' ';

  }

  return (str == checkstr);

}

  function check(){


  if(checkspace(myEditor.getHTML())){

       alert('请输入歌词!');

	   myEditor.focus();

	  return false;

  }

  formadd.lyric.value=myEditor.getHTML();

    document.formadd.submit();

}

function getPicture()

{

	var sPicture = ShowDialog("Img.htm",350,140);

	if(sPicture!=null)

	{

		document.formadd.NewsPicture.value = sPicture;

	}

}

// 显示无模式对话框

function ShowDialog(url, width, height) {

	var arr = window.showModalDialog(url,window,"dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:no;status:no");

	return arr;

}

</script>

<form name="formadd" method="POST" action="add_do.jsp">
<tr>
<td>歌曲图标:</td><td><input name="NewsPicture" type="text" class="chinese" id="NewsPicture"  size=25 maxlength="80" style="display:" value="">

<input name="UpImg" type="button" class="button" id="UpImg" 

onClick="getPicture()" value="上传歌曲图标>>"> </td></tr>
  <tr>
    <td width="130" height="25" align="right">歌词:</td>
    <td height="25" colspan="2">&nbsp;</td>
  </tr>
<tr>
    <td height="25" colspan="3"><div align="center">
      <textarea name="lyric" class="chinese" style="display:none"></textarea>
      <iframe ID="myEditor" src="../eWebEditor.jsp?id=lyric&style=CoolBlue" frameborder="0" scrolling="no" width="620" height="350"></iframe>
    </div></td>
    </tr>
<tr>
    <td colspan=3><p align="center"><br>
      <input type="submit" value="保 存" class="leftbutton" onClick="javascript:return check()">
      <br>
      <br><br></p></td>
  </tr>

</form>
 
 

http://www.niftyadmin.cn/n/1425776.html

相关文章

菜菜的深度学习笔记 | 基于Python的理论与实现(二)—> 激活函数与多维数组

系列索引&#xff1a;菜菜的深度学习笔记 | 基于Python的理论与实现 文章目录一、激活函数&#xff08;1&#xff09;阶跃函数的实现&#xff08;2&#xff09;sigmoid函数的实现&#xff08;3&#xff09;阶跃函数和sigmoid函数对比&#xff08;4&#xff09;非线性函数&#…

hibernate 乱码的解决 要正取反插

正取的编码是 new String(request.getParameter("sdf").getBytes("iso-8859-1"),"GB2312"); 反插的编码是 School.setName(new String("小裴".getBytes("GB2312"),"iso-8859-1"));

菜菜的深度学习笔记 | 基于Python的理论与实现(三)—> 3层神经网络的设计

系列索引&#xff1a;菜菜的深度学习笔记 | 基于Python的理论与实现 文章目录一、3层神经网络的实现&#xff08;1&#xff09;分层设计&#xff08;2&#xff09;代码小结二、输出层的设计&#xff08;1&#xff09;恒等函数和softmax函数&#xff08;2&#xff09;实现softma…

hibernate之映射关系 1对多 +session常用方法

多个班级对应一个年级表 schoolclass id name grade_id grade id name 实体bean Grade.java package my.bean;public class Schoolclass implements java.io.Serializable {private long id;private String name;private Grade grade;public Schoolclass() {}pu…

菜菜的深度学习笔记 | 基于Python的理论与实现(四)—>手写数字识别

系列索引&#xff1a;菜菜的深度学习笔记 | 基于Python的理论与实现 文章目录一、神经网络实战——手写数字识别一、神经网络实战——手写数字识别 假设已经学习结束&#xff0c;我们使用学习到的参数先实现神经网络的“推理处理”&#xff0c;也叫做前向传播。 MNIST数据集&…

Hibernate的ID的标识符生成器

“increment” 主键按数值顺序递增。此方式的实现机制为在当前应用实例中维持一个变量&#xff0c;以保存着当前的最大值&#xff0c;之后每次需要生成主键的时候将此值加1作为主键。这种方式可能产生的问题是&#xff1a;不能在集群下使用。(只有在没有其他进程往同一张表中插…

菜菜的深度学习笔记 | 基于Python的理论与实现(五)—>神经网络的学习

系列索引&#xff1a;菜菜的深度学习笔记 | 基于Python的理论与实现 文章目录一、神经网络的学习&#xff08;1&#xff09;数据驱动&#xff08;2&#xff09;训练数据和测试数据&#xff08;3&#xff09;损失函数均方误差&#xff1a;交叉熵误差&#xff1a;mini-batch学习&…

hibernate的关联

1.单向关联 单向关联&#xff08;Unidirectional associations&#xff09; 7.2.1. 多对一(many to one) 单向many-to-one关联是最常见的单向关联关系。 <class name"Person"> <id name"id" column"personId"> <ge…