后台向前台js传递参数

  aspx页面代码 //图片预览效果 function ShowPic(url) { document.getElementById("picture").style.display=" "; document.getElementById("picture").style.left=even t.clientX+5; document.getElementById("picture").style.top=event .clientY+5; document.getElementById("picture").innerHTML= ""; } function ShowVideo(url) { document.getElementById("video").style.display=""; document.getElementById("video").style.left=event. clientX+5; document.getElementById("video").style.top=event.c lientY+5; document.getElementById("video").innerHTML= " "; } function ShowDivMusic(url) { document.getElementById("divMusic").style.display= ""; document.getElementById("divMusic").style.left=eve nt.clientX+5; document.getElementById("divMusic").style.top=even t.clientY+5; document.getElementById("divMusic").innerHTML=""; } 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.background Color="white"; document.getElementById("PreTxt").innerHTML=conten t; } function DisappearDivMusic() { document.getElementById("divMusic").style.display= "none"; document.getElementById("music").controls.pause(); document.clear(); } function DisappearDivVideo() { document.getElementById("video").style.display="no ne"; document.getElementById("MediaPlayer").controls.st op(); document.clear(); } function DisappearDivPic() { document.getElementById("picture").style.display=" none"; } function DisppearTxt() { document.getElementById("PreTxt").style.display="n one"; } 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(); } 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()"); }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值