aspx页面代码
<script language="javascript" type="text/javascript">
//图片预览效果
function ShowPic(url)
{
document.getElementById("picture").style.display="";
document.getElementById("picture").style.left=event.clientX+5;
document.getElementById("picture").style.top=event.clientY+5;
document.getElementById("picture").innerHTML= "<img src='"+url+"' width='200' height='200'/>";
}
function  ShowVideo(url)
{
document.getElementById("video").style.display="";
document.getElementById("video").style.left=event.clientX+5;
document.getElementById("video").style.top=event.clientY+5;
document.getElementById("video").innerHTML=   "<object id='MediaPlayer' width=300 height=250 classid='CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6'> <param name='URL' value='"+url+"'><param name='rate' value='1'> <param name='balance' value='0'> <param name='currentPosition' value='0'> <param name='defaultFrame' value> <param name='playCount' value='100'> <param name='autoStart' value='1'> <param name='currentMarker' value='0'> <param name='invokeURLs' value='1'> <param name='baseURL' value> <param name='volume' value='100'> <param name='mute' value='0'> <param name='uiMode' value='full'> <param name='stretchToFit' value='0'> <param name='windowlessVideo' value='0'> <param name='enabled' value='1'> <param name='enableContextMenu' value='1'> <param name='fullScreen' value='0'> <param name='SAMIStyle' value> <param name='SAMILang' value> <param name='SAMIFilename' value> <param name='captioningID' value> <param name='enableErrorDialogs' value='0'>  <param name='_cx' value='7779'> <param name='_cy' value='1693'> </object>";
}
function  ShowDivMusic(url)
{
document.getElementById("divMusic").style.display="";
document.getElementById("divMusic").style.left=event.clientX+5;
document.getElementById("divMusic").style.top=event.clientY+5;
document.getElementById("divMusic").innerHTML="<embed id='music' type='video/x-ms-wmv'  align='middle' autostart='true' height='45' width='300' loop='true' src='"+url+"'></embed>";
}
function PriveiwTxt(content)
{
document.getElementById("PreTxt").style.display="";
document.getElementById("PreTxt").style.left=event.clientX+5;
document.getElementById("PreTxt").style.top=event.clientY+5;
document.getElementById("PreTxt").style.backgroundColor="white";
document.getElementById("PreTxt").innerHTML=content;
}
function  DisappearDivMusic()
{
document.getElementById("divMusic").style.display="none";
document.getElementById("music").controls.pause();
document.clear();
}
function  DisappearDivVideo()
{
document.getElementById("video").style.display="none";
document.getElementById("MediaPlayer").controls.stop();
document.clear();
}
function DisappearDivPic()
{
document.getElementById("picture").style.display="none";
}
function DisppearTxt()
{
document.getElementById("PreTxt").style.display="none";
}
function Disppear()
{
var existPreTxt = document.getElementById("PreTxt");
var existPicture = document.getElementById("picture");
var existvideo = document.getElementById("video");
var existMediaPlayer = document.getElementById("MediaPlayer");
var existmusic = document.getElementById("divMusic");
var existtestmusic = document.getElementById("music");
if(existPreTxt!=null)
DisppearTxt();
if(existPicture!=null)
DisappearDivPic();
if(existMediaPlayer!=null && existvideo!=null)
DisappearDivVideo();
if(existtestmusic!=null && existtestmusic!=null)
DisappearDivMusic();
}
</script>
</head>
<body οnclick="Disppear()">
<div id="picture" style="display:none; width:200px; height:200px; border-bottom:1px solid #FF0000; border-left:1px solid #FF0000;border-top:1px solid #FF0000;border-right:1px solid #FF0000;position:absolute;">
</div>
<div id="video" style="display:none; width:300px; height:45px; border-bottom:1px solid #FF0000; border-left:1px solid #FF0000;border-top:1px solid #FF0000;border-right:1px solid #FF0000;position:absolute;">
</div>
<div id="divMusic" style="display:none; width:300px; height:45px; border-bottom:1px solid #FF0000; border-left:1px solid #FF0000;border-top:1px solid #FF0000;border-right:1px solid #FF0000;position:absolute;">
</div>
<div id="PreTxt" style="display:none; width:600px; height:200px; border-bottom:1px solid #FF0000; border-left:1px solid #FF0000;border-top:1px solid #FF0000;border-right:1px solid #FF0000;position:absolute;">
</div>
cs页面代码
bool legalPic = false;
bool legalVideo = false;
bool legalAudio = false;
string[] picArray = { "jpg","gif","bmp","pcx","jpeg","png"};
string[] videoArray = { "rmvb", "flv", "rm", "wmv", "mp4", "avi" };
string[] audioArray = { "mp3", "wma" };
foreach (string pic in picArray)
{
if (itemKind.Equals(pic))
legalPic = true;
}
foreach (string video in videoArray)
{
if (itemKind.Equals(video))
legalVideo = true;
}
foreach (string audio in audioArray)
{
if (itemKind.Equals(audio))
legalAudio = true;
}
//图片预览特效
if (legalPic)
TitleLB.Attributes.Add("onmouseover", "ShowPic('"+ URL +"')");            else if (legalVideo)
TitleLB.Attributes.Add("onmouseover", "ShowVideo('" + URL + "')");            else if (legalAudio)
TitleLB.Attributes.Add("onmouseover", "ShowDivMusic('" + URL + "')");            else if (itemKind.Equals("txt"))
{
//创建预览对象
Preview preivew = new Preview();
//通过url地址来返回txt文本前五十行内容
string previewTxt = preivew.txtToText(URL);
TitleLB.Attributes.Add("onmouseover", "PriveiwTxt('" +previewTxt + "')");               // TitleLB.Attributes.Add("onmouseout", "return DisppearTxt()");
}

后台向前台js传递参数相关推荐

  1. ajax参数中有加号,浅谈在js传递参数中含加号(+)的处理方式

    一般情况下,URL 中的参数应使用 url 编码规则,即把参数字符串中除了 -_. 之外的所有非字母数字字符都将被替换成百分号(%)后跟两位十六进制数,空格则编码为加号(+). 但是对于带有中文的参数 ...

  2. C#后台调用前台js(RegisterStartupScript)

    C#后台调用前台js代码 前台js <script type="text/javascript" language="javascript"> fu ...

  3. c#调用js脚本报错_C#后台调用前台JS函数方法

    总结了公司其他人的一些C#后台调用前台的方法: 方法一: 假设前台页面的JS脚本标签中有如下函数: function A() { alert("hello word!"); } 那 ...

  4. 在js传递参数中含加号(+)的处理方式

    一般情况下,url中的参数应使用 url 编码规则,即把参数字符串中除了 " - "." _ " ." . "之外的所有非字母数字字符都将被 ...

  5. ASP.NET后台调用前台JS函数的三种常见方法

    为什么80%的码农都做不了架构师?>>>    第一种:使用普通的添加控件中的Attributes属性进行调用 例如,像一般的普通的按钮:Button1.Attributes.Add ...

  6. js向php传递中文参数,JS传递参数时对中文进行编码和解码

    Nginx 配置简述 不论是本地开发,还是远程到 Server 开发,还是给提供 demo 给人看效果,我们时常需要对 Nginx 做配置,Nginx 的配置项相当多,如果考虑性能配置起来会比较麻烦. ...

  7. js 传递参数中文乱码

    换成这种方式接收 function getQueryString(key){var reg = new RegExp("(^|&)"+key+"=([^& ...

  8. aspnet 后台调用前台js函数

    this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "testalert", " <s ...

  9. ASP.NET前台JS与后台CS函数如何互相调用

    在实际的Web开发中,我们可能会常常遇到后台调用前台JS代码或者前台JS调用后台代码的情况.今天就把比较实用的前后台相互调用的方法总结出来和大家分享. <1>后台代码调用前台JS代码 一. ...

最新文章

  1. JDK1.8源码(三)——java.lang.String 类
  2. 计算机组装与维修属于什么类,《计算机组装与维修》课程学业水平测试卷(样卷 答案)...
  3. 《数据库系统实训》实验报告——子查询与组合查询
  4. VS2003转VS2010 fatal error C1189: #error
  5. java 解析csv 乱码_Java采用opencsv解析csv文件以及解析中文乱码问题
  6. C++——random库中的uniform_int_distribution
  7. 对Python装饰器的个人理解方法
  8. C语言之文件读写探究(一):fopen、fclose(文件的打开和关闭)
  9. CCNA基础实验:配置帧中继网络
  10. 【Linux 命令学习第二天】
  11. C语言程序设计题库(精心准备,内容丰富)
  12. C++:n个清屏函数(缓冲清屏不闪屏)
  13. docker阿里云镜像加速器
  14. 项目案例之决策树在保险行业的应用
  15. 自旋量子计算机,硅基量子计算机的突破:自旋量子位的远距离连接
  16. 西安建筑科技大学计算机系专业怎么样,西安建筑科技大学好就业吗?附西安建筑大学就业年薪...
  17. Tiny C Compiler最小的C语言编译器
  18. TIA博途V17中如何创建和使用VoT应用程序_Web功能
  19. 上手python之字典
  20. 查看索引是否命中oracle,Oracle索引命中与扫描规律总结

热门文章

  1. CentOs6.5 更新python2.7,以及tab自动补全
  2. Fedora 17 结实的奇迹:最新的OpenStack和JBoss
  3. 周立功-成功心法(1):低年级大学生如何查资料写论文
  4. 分享一些方便实用的素材网站
  5. 面试官系统精讲Java源码及大厂真题 - 08 HashMap 源码解析
  6. Jenkins+Github+Nginx实现前端项目自动部署
  7. ORACLE Dataguard安装
  8. Java Singleton类中的线程安全性的示例代码
  9. 根据用户查进程_Linux中的系统进程管理
  10. 2021 npm安装Electron失败解决方法