javascript1.js
来自「Telerik是很大的第三方软件制造商」· JavaScript 代码 · 共 30 行
JS
30 行
function ImageChanger(imageId, parentId)
{
var thisObject = this;
this.Image = document.getElementById(imageId);
this.Parent = document.getElementById(parentId);
var Button1 = document.createElement("input");
Button1.type = "button";
Button1["class"] = "button";
Button1.style.width = "150px";
Button1.value = "Change to grayscale";
Button1.onclick = function(){thisObject.Change("Img/img_" + (window.currentIndex + 1) + "_bw.jpg")};
var Button2 = document.createElement("input");
Button2.type = "button";
Button2["class"] = "button";
Button2.style.width = "150px";
Button2.value = "Change to sepia";
Button2.onclick = function(){thisObject.Change("Img/img_" + (window.currentIndex + 1) + "_sepia.jpg")};
this.Parent.appendChild(Button1);
this.Parent.appendChild(Button2);
}
ImageChanger.prototype.Change = function(src)
{
this.Image.src = src;
};
var ImageChanger1 = new ImageChanger('myImg', 'ImageChangerContainer');
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?