<script >
function showimage()
{
//IMG1为图片控件或Div,File1为上传文件控件
document.getElementById("IMG1"). src = document.getElementById("File1").value;
}
</script >
控件中引用:
<input id="File1" runat="server" type="file" onchange="showimage()"/>
IE7.0中由于不支持绝对路径,会出现图片显示错误.解决办法:
<script >
function showimage()
{
document.getElementById("IMG1").filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src =
document.getElementById ("File1").value;
}
</script >
控件中引用:
<input id="File1" runat="server" type="file" onchange="showimage()"/>
另外需在IMG或DIV样式中修改:
<div id="IMG1" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);width:400px;height:200px;" runat="server" src="" ......
<script type="text/javascript">
function dayChange(year,month,day){
var selectYear = document.getElementById(year);
var selectMonth = document.getElementById(month);
var selectDay = document.getElementById(day);
var y = selectYear.value,m = selectMonth.value,d = selectDay.value;
if(m==4||m==6||m==9||m==11){
if(selectDay.length == 31){
selectDay.options.remove(30);
}
if(selectDay.length == 29){
selectDay.options.add(30,30);
}
if(selectDay.length == 28){
selectDay.options.add(29,29);
selectDay.options.add(30,30);
}
}
if(m==1||m==3||m==5||m==7||m==8||m==10||m==12){
if(selectDay.length == 30){
selec ......
添加
<script>
var oDiv = document.createElement("DIV");
oDiv.id = "shop01";
oDiv.style.top = 200;
oDiv.style.left = 200;
oDiv.style.background = '#FFFF00';
oDiv.style.visibility = 'visible';
oDiv.innerHTML="123123"
document.body.appendChild(oDiv);
oDiv.onclick = abc;
function abc(){
alert("abc");
}
</script>
删除div:
function deldiv(divid){
var div=document.getElementById(divid);
div.parentNode.removeChild(div);
}
另:
获得一个控件var xxoo = document.createElement('xxoo');
设置属性
然后可以获得一个div的控件然后div.appendChild(xxoo);
......
String.prototype.HTMLEncode = function() {
var temp = document.createElement ("div");
(temp.textContent != null) ? (temp.textContent = this) : (temp.innerText = this);
var output = temp.innerHTML;
temp = null;
return output;
}
String.prototype.HTMLDecode = function() {
var temp = document.createElement("div");
temp.innerHTML = this;
var output = temp.innerText || temp.textContent;
temp = null;
return output;
}
上面代码转自:http://www.jb51.net/article/18396.htm
本人对javascript的核心技术不是太熟悉,再加上现在又在用不熟悉的EXT来编写前台页面代码,所以只得用最笨的方法,不扩展String自己写处理函数:
htmlDecode:function(str){
var temp = document.createElement ("div");
temp.innerHTML = str;
var output = temp.innerText || temp.textContent;
temp=null;
return output;
}
htmlEncode:function(str){
var temp = document.createElement ("div");
(temp.textContent ! ......
String.prototype.HTMLEncode = function() {
var temp = document.createElement ("div");
(temp.textContent != null) ? (temp.textContent = this) : (temp.innerText = this);
var output = temp.innerHTML;
temp = null;
return output;
}
String.prototype.HTMLDecode = function() {
var temp = document.createElement("div");
temp.innerHTML = this;
var output = temp.innerText || temp.textContent;
temp = null;
return output;
}
上面代码转自:http://www.jb51.net/article/18396.htm
本人对javascript的核心技术不是太熟悉,再加上现在又在用不熟悉的EXT来编写前台页面代码,所以只得用最笨的方法,不扩展String自己写处理函数:
htmlDecode:function(str){
var temp = document.createElement ("div");
temp.innerHTML = str;
var output = temp.innerText || temp.textContent;
temp=null;
return output;
}
htmlEncode:function(str){
var temp = document.createElement ("div");
(temp.textContent ! ......
JavaScript API
One of the new features we added to the ASP.Net Report Viewer in Visual Studio 2010 is a JavaScript API to allow you to interact with the viewer on client. In reading many of the posts on the report controls forum, we found that many people struggle when implementing a custom toolbar or replacing portions of the toolbar functionality. The new JavaScript API is intended to make it easier for you to provide the same functionality available through the built-in toolbar with a minimum amount of effort.
The JavaScript API is exposed through the client side ReportViewer object. Specifically, it’s the Microsoft.Reporting.WebFormsClient.ReportViewer class. An instance of this class is created on the client for each instance of the ReportViewer control on the page.
Referencing the client side viewer
The ReportViewer client side object inherits from Sys.UI.Control. To obtain a reference to the client side viewer, use the $find method as fo ......
var currItem = listbox.options[currIndex];
var prevItem = listbox.options[currIndex - 1];
//alert(currItem);
alert(prevItem.text);
listbox.options[currIndex - 1].text = currItem.text;
listbox.options[currIndex - 1].value = currItem.value;
alert(prevItem.text); //两次alert值是不同的
& ......