最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

window.js 主要包含了頁面的一些操作

 更新時(shí)間:2009年12月23日 18:48:00   作者:  
主要是獲取頁面元素的一些信息,所以明名為window.js,想要學(xué)習(xí)的朋友可以參考下。
復(fù)制代碼 代碼如下:

//處理頁面異常
function Exception() {
}

//頁面元素共同接口
function View() {
//頁面元素
this.element = null;
//文字顏色
this.color = null;

//設(shè)置樣式
this.setStyle = function(name, value) {
eval("this.element.style." + name + " = '" + value + "'");
}
//獲取樣式
this.getStyle = function(name) {
return eval("this.element.style." + name);
}

//設(shè)置浮動(dòng)樣式
this.setFloat = function(styleFloat) {
this.setStyle("styleFloat", styleFloat);
}
//設(shè)置背景色
this.setBackgroundColor = function(backgroundColor) {
this.setStyle("backgroundColor", backgroundColor);
}
//獲取背景色
this.getBackgroundColor = function() {
return this.getStyle("backgroundColor");
}
//設(shè)置對(duì)象寬度
this.setWidth = function(width) {
//alert(width);
this.setStyle("width", width);
}
//設(shè)置對(duì)象寬度
this.setHeight = function(height) {
this.setStyle("height", height);
}
//設(shè)置頁面定位
this.setPosition = function(position) {
this.setStyle("position", position);
}
//設(shè)置層
this.setZIndex = function(zIndex) {
this.setStyle("zIndex", zIndex);
}
//左邊距離
this.setLeft = function(left) {
this.setStyle("left", left);
}
//上邊距離
this.setTop = function(top) {
this.setStyle("top", top);
}
//是否換行
this.setWhiteSpace = function(whiteSpace) {
this.setStyle("whiteSpace", whiteSpace);
}
this.setMargin = function(margin) {
this.setStyle("margin", margin);
}
this.setPadding = function(padding) {
this.setStyle("padding", padding);
}

//設(shè)置屬性
this.setAttributeIsHave = function(attrName, value) {
eval("this.element.setAttribute('" + attrName + "', '" + value + "')");
}
this.setId = function(id) {
this.setAttributeIsHave("id", id);
}
this.setInnerText = function(innertext) {
this.setAttributeIsHave("innerText", innertext);
}

//加入自定義屬性
this.setAttributeIsNot = function(attrName, value) {
var attr = document.createAttribute(attrName);
attr.value = value;
this.element.setAttributeNode(attr);
}

//事件監(jiān)聽
this.eventListener = function(eventName, exec) {
this.element.attachEvent(eventName, exec);
}
//鼠標(biāo)移入對(duì)象事件
this.onmouseenterListener = function(exec) {
this.eventListener("onmouseenter", exec);
}
//鼠標(biāo)移出對(duì)象事件
this.onmouseleaveListener = function(exec) {
this.eventListener("onmouseleave", exec);
}
//鼠標(biāo)單擊對(duì)象事件
this.onclickListener = function(exec) {
this.eventListener("onclick", exec);
}
}

//單一元素
function Single() {
View.call(this);
}
//可以有子元素
function Multi() {
View.call(this);
//子元素集合
this.childElementList = new Array();
//加入子元素
this.addView = function(childElement) {
if(this.element == null) {
//待加入異常信息
return;
}
this.childElementList[this.childElementList.length] = childElement;
}
//關(guān)聯(lián)子元素
this.appendChildElement = function(childElement) {
this.element.appendChild(childElement.element);
}
//顯示元素
this.show = function() {
for(var i = 0; i < this.childElementList.length; i++) {
var childElement = this.childElementList[i];
this.appendChildElement(childElement);
childElement.show();
}
}
}
//面板
function Panel() {
Multi.call(this);
//創(chuàng)建頁面元素
this.element = document.body;
}
//行布局
function LineLayout() {
Multi.call(this);
this.element = document.createElement("div");
}
//左布局
function LeftLayout() {
Multi.call(this);
this.element = document.createElement("div");
this.setFloat("left");
}
//右布局
function RightLayout() {
Multi.call(this);
this.element = document.createElement("div");
this.setFloat("right");
}
function Menu() {
Multi.call(this);
this.element = document.createElement("div");
this.setWidth("100%");
var clickListener = function() {
return;
};
var moveInBackgroundColor = "red";
var moveOutBackgroundColor = this.getBackgroundColor();
this.show = function() {
var menuItem = null;
var menuEntiy = null;
for(var i = 0; i < this.childElementList.length; i++) {
menuItem = new MenuItem();
menuEntiy = this.childElementList[i];
menuItem.addMenuEntity(menuEntiy);
menuItem.onmouseenterListener(moveInMenuItem);
menuItem.onmouseleaveListener(moveOutMenuItem);
menuItem.onclickListener(this.clickMenuItem );
menuItem.setPadding("0 5px 0 5px");
this.appendChildElement(menuItem);
}
}
this.setClickListener = function(exec) {
clickListener = exec;
}
function moveInMenuItem() {
event.srcElement.style.backgroundColor = moveInBackgroundColor;
}
function moveOutMenuItem() {
event.srcElement.style.backgroundColor = moveOutBackgroundColor;
}

this.clickMenuItem = function() {
var child = clickListener();
document.body.appendChild(child.element);
child.setLeft(event.srcElement.offsetLeft);
child.setTop(event.srcElement.offsetParent.offsetTop + event.srcElement.clientHeight);
child.show();
}
}
function ChildMenu() {
Multi.call(this);
this.element = document.createElement("div");
this.setPosition("absolute");
this.setZIndex(100);
this.setBackgroundColor("#ccffcc");
var moveInBackgroundColor = "red";
var moveOutBackgroundColor = this.getBackgroundColor();
this.show = function() {
var menuItem = null;
var menuEntiy = null;
for(var i = 0; i < this.childElementList.length; i++) {
menuItem = new MenuItem();
menuItem.setFloat("none");
menuEntiy = this.childElementList[i];
menuItem.addMenuEntity(menuEntiy);
menuItem.onmouseenterListener(moveInMenuItem);
menuItem.onmouseleaveListener(moveOutMenuItem);
//menuItem.onclickListener(clickMenuItem);
menuItem.setPadding("0 5px 0 15px");
this.appendChildElement(menuItem);
}
}
function moveInMenuItem() {
event.srcElement.style.backgroundColor = moveInBackgroundColor;
}
function moveOutMenuItem() {
event.srcElement.style.backgroundColor = moveOutBackgroundColor;
}
}

function MenuEntiy(id, name, action) {
this.id = id;
this.name = name ;
this.action = action;
}
function MenuItem() {
Single.call(this);
this.element = document.createElement("div");
this.setFloat("left");
this.setWhiteSpace("nowrap");
this.addMenuEntity = function(menuEntity) {
this.setId(menuEntity.id);
this.setInnerText(menuEntity.name);
this.setAttributeIsNot("action", menuEntity.action);
}
}

相關(guān)文章

  • uni-app學(xué)習(xí)之nvue使用教程

    uni-app學(xué)習(xí)之nvue使用教程

    uni-app可以說是目前跨端數(shù)最多的框架之一了,這篇文章主要給大家介紹了關(guān)于uni-app學(xué)習(xí)之nvue使用的相關(guān)資料,文中介紹的非常詳細(xì),需要的朋友可以參考下
    2022-11-11
  • wordpress之js庫集合研究介紹

    wordpress之js庫集合研究介紹

    wordpress之js庫集合研究介紹...
    2007-08-08
  • 超全面的JavaScript開發(fā)規(guī)范(推薦)

    超全面的JavaScript開發(fā)規(guī)范(推薦)

    作為一名開發(fā)人員(WEB前端JavaScript開發(fā)),不規(guī)范的開發(fā)不僅使日后代碼維護(hù)變的困難,同時(shí)也不利于團(tuán)隊(duì)的合作,通常還會(huì)帶來代碼安全以及執(zhí)行效率上的問題。本文就主要介紹了關(guān)于Javascript的命名規(guī)范、注釋規(guī)范以及框架開發(fā)的一些問題,需要的朋友可以參考學(xué)習(xí)。
    2017-01-01
  • JavaScript中的this引用(推薦)

    JavaScript中的this引用(推薦)

    this是javascript的一個(gè)關(guān)鍵字,隨著函數(shù)使用場(chǎng)合不同,this的值會(huì)發(fā)生變化。這篇文章主要介紹了JavaScript中的this引用的相關(guān)資料,非常不錯(cuò),需要的朋友可以參考下
    2016-08-08
  • Bootstrap整體框架之CSS12柵格系統(tǒng)

    Bootstrap整體框架之CSS12柵格系統(tǒng)

    這篇文章主要介紹了Bootstrap整體框架之CSS12柵格系統(tǒng)的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2016-12-12
  • JavaScript原型繼承和原型鏈原理詳解

    JavaScript原型繼承和原型鏈原理詳解

    這篇文章主要介紹了JavaScript原型繼承和原型鏈原理詳解,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-02-02
  • 原生JS實(shí)現(xiàn)音樂播放器的示例代碼

    原生JS實(shí)現(xiàn)音樂播放器的示例代碼

    這篇文章主要介紹了原生JS實(shí)現(xiàn)音樂播放器的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-02-02
  • js實(shí)現(xiàn)無縫滾動(dòng)圖

    js實(shí)現(xiàn)無縫滾動(dòng)圖

    本文主要分享了js實(shí)現(xiàn)無縫滾動(dòng)圖的示例代碼,具有很好的參考價(jià)值,下面跟著小編一起來看下吧
    2017-02-02
  • 簡(jiǎn)單實(shí)現(xiàn)輪播圖效果的實(shí)例

    簡(jiǎn)單實(shí)現(xiàn)輪播圖效果的實(shí)例

    下面小編就為大家?guī)硪黄?jiǎn)單實(shí)現(xiàn)輪播圖效果的實(shí)例。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2016-07-07
  • javascript單例模式與策略模式實(shí)例詳解

    javascript單例模式與策略模式實(shí)例詳解

    這篇文章主要介紹了javascript單例模式與策略模式,結(jié)合實(shí)例形式詳細(xì)分析了javascript單例模式與策略模式基本概念、功能、實(shí)現(xiàn)技巧與相關(guān)注意事項(xiàng),需要的朋友可以參考下
    2023-06-06

最新評(píng)論

班玛县| 荣成市| 大厂| 油尖旺区| 布拖县| 蕉岭县| 库伦旗| 阿瓦提县| 申扎县| 闻喜县| 青州市| 台南县| 武陟县| 应用必备| 普定县| 奇台县| 忻州市| 望江县| 河南省| 醴陵市| 西畴县| 江源县| 乌海市| 民县| 安宁市| 富民县| 金阳县| 冷水江市| 太保市| 白水县| 南和县| 贵南县| 甘谷县| 无极县| 邯郸市| 太白县| 澎湖县| 江油市| 大悟县| 沾化县| 鸡泽县|