insertpic.asp

来自「OFFICE办公自动化」· ASP 代码 · 共 104 行

ASP
104
字号
<html>
<head>
<title>插入图片</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
function insertphoto(url,alt,align,border,hspace,vspace,bigurl){
if (url!="") {
    var sel,RangeType
    opener.Composition.focus();
    sel = opener.Composition.document.selection.createRange();
	if(bigurl!=""){
    sel.pasteHTML("<a href=" + bigurl + " target=_blank><img src=" + url + " alt='" + alt + "'  align='" + align + "'  border=" + border + "  hspace=" + hspace + "  vspace=" + vspace + "></a>");
    }else{
	sel.pasteHTML("<img src=" + url + " alt='" + alt + "'  align='" + align + "'  border=" + border + "  hspace=" + hspace + "  vspace=" + vspace + ">");
	}
	sel.select();
	window.close();

}else{
	alert("请提供图片路径!")
	return false
}
}
</script>

<style type="text/css">
 td {font-size: 9pt}
 body {font-size: 9pt}
 button {width:5em}
</style>

</head>

<body bgcolor="#f6f6f6">
<form name="form1" method="post" action="">
  <table width="390" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
      <td height="25"> 
        <div align="center">插入图片选项</div>
      </td>
    </tr>
  </table><br>
  <table width="390" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr> 
      <td colspan="2">
	  图片来源: 
        <input type="text" name="url" size="20" value="<%=session("path1")%>">
        <input type="button" name="Button" value="确定" onClick="insertphoto(document.form1.url.value,document.form1.alt.value,document.form1.align.value,document.form1.border.value,document.form1.hspace.value,document.form1.vspace.value,document.form1.bigurl.value)">
        <input type="button" value="上传图片" onClick='upload();' name="button">
<script>
function upload()
{
	var str;
	var arr_image=new Array();
	str=window.showModalDialog("form.html","","dialogWidth:20;dialogHeight:15");
	if (!str) return false;
	arr_image=str.split("||");
	document.form1.url.value=arr_image[0];
	document.form1.bigurl.value=arr_image[1];
	document.form1.url.focus();
	return true;
}
</script>
        <input type="hidden" name="bigurl">
      </td>
    </tr>
    <tr> 
      <td colspan="2">替换文字: 
        <input type="text" name="alt" size="20">
        <input type="reset" name="Button2" value="取消">
      </td>
    </tr>
    <tr> 
      <td width="51%">对齐方式: 
        <select name="align">
          <option value="" selected>未设置</option>
          <option value="left">左对齐</option>
          <option value="right">右对齐</option>
		  <option value="textTop">文本上方</option>
		  <option value="absMiddle">正中央</option>
		  <option value="baseline">基线</option>
		  <option value="absBottom">正下方</option>
		  <option value="bottom">下方</option>
		  <option value="middle">中央</option>
		  <option value="top">上方</option>
 </select>
      </td>
      <td width="49%">水平间隔:
        <input type="text" name="hspace" size="10" value="0">
      </td>
    </tr>
    <tr>
      <td width="51%">边框宽度:
        <input type="text" name="border" size="10" value="0">
      </td>
      <td width="49%">垂直间隔:
        <input type="text" name="vspace" size="10" value="0">
      </td>
    </tr>
  </table>
  </form>
</body>
</html>
 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?