依然的小屋
導航
BlogJava
首頁
新隨筆
聯系
聚合
管理
統計
隨筆 - 1
文章 - 46
評論 - 82
引用 - 0
常用鏈接
我的隨筆
我的文章
我的評論
我的參與
最新評論
留言簿
(5)
給我留言
查看公開留言
查看私人留言
隨筆檔案
(1)
2009年4月 (1)
文章分類
(37)
Ajax學習筆記
(rss)
css(2)
(rss)
DWR(1)
(rss)
Google Map API 學習(3)
(rss)
Html
(rss)
javascript(7)
(rss)
Java基礎知識惡補篇(9)
(rss)
jstl(1)
(rss)
oracle(3)
(rss)
photoshop(1)
(rss)
spring(1)
(rss)
tomcat(1)
(rss)
webservice(3)
(rss)
心情日記(1)
(rss)
正則表達式(2)
(rss)
面試(2)
(rss)
文章檔案
(43)
2013年6月 (3)
2011年4月 (1)
2010年5月 (2)
2009年10月 (1)
2009年7月 (2)
2009年6月 (1)
2009年5月 (1)
2009年4月 (2)
2008年11月 (1)
2008年10月 (5)
2008年9月 (2)
2008年8月 (6)
2008年7月 (14)
2008年6月 (2)
友情鏈接
子貓の部屋
負罪者
搜索
最新評論
1.?re: WebSphere 部署的問題[未登錄]
請問在AIX系統里部署應用時systemerr反饋了ClassNotFound ,WAS6.1是在哪里配置
--Season
2.?re: js的className改變網頁class屬性
多謝 我也不知道
--fd
javascirpt在網頁中添加控件
javascript不是很難,但添加控件的事件如onclick等,要用attachEvent('onclick',調用的函數),不過這只是IE的寫法,其它的寫法以后再做
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>JS test</title>
</head>
<body>
<input type="button" name="Button1" value="創建DIV" onClick="createDiv()">
</body>
</html>
<script language="javascript">
<!--
function createDiv(){
var div1 = document.createElement("DIV");
div1.id = "div1";
div1.style.position="absolute";
div1.style.top=40;
div1.style.left=0;
div1.style.width='644px';
div1.style.height='229px';
div1.style.background = "#FFFF00";
div1.style.visibility = "visible";
div1.innerHTML="";
document.body.removeChild(this.document.getElementById("Button1"));
document.body.appendChild(div1);
createLabel(div1,30,5,"顏色");
createInput("text","DivCorlor",30,30,div1);
createBR(div1);
createLabel(div1,50,5,"透明度");
createInput("text","DivTM",50,30,div1);
createBR(div1);
createLabel(div1,70,5,"大小:");
createLabel(div1,70,9,"寬度");
createInput("text","DivWidth",70,15,div1);
createLabel(div1,70,39,"高度");
createInput("text","DivHeight",70,43,div1);
createBR(div1);
createLabel(div1,90,5,"位置:");
createLabel(div1,90,9,"top");
createInput("text","DivTop",90,15,div1);
createLabel(div1,90,39,"left");
createInput("text","DivLeft",90,43,div1);
createBR(div1);
createButton(110,30,div1);
}
function createLabel(appendObj,topObj,leftObj,textObj)
{
var label1= document.createElement("Label");
label1.style.position="relative";
label1.style.top=topObj;
label1.style.left=leftObj;
label1.innerHTML=textObj;
appendObj.appendChild(label1);
}
function createInput(typeObj,nameObj,topObj,leftObj,appendObj)
{
var input1 = document.createElement("INPUT");
input1.type=typeObj;
input1.name=nameObj;
input1.id=nameObj;
input1.size="20";
input1.style.position="relative";
input1.style.top=topObj;
input1.style.left=leftObj;
appendObj.appendChild(input1);
}
function createBR(appendObj)
{
var br1 = document.createElement("BR");
appendObj.appendChild(br1);
}
function createButton(topObj,leftObj,appendObj)
{
var input1 = document.createElement("INPUT");
input1.type="button";
input1.name="Button1";
input1.id="Button1";
input1.style.position="relative";
input1.style.top=topObj;
input1.style.left=leftObj;
input1.value="改變";
input1.attachEvent('onclick', divChange);
appendObj.appendChild(input1);
}
function test()
{
var obj=this.document.getElementById("Button1");
alert(obj);
alert(obj.onClick);
}
function divChange()
{
var divObj=this.document.getElementById("div1");
divObj.style.width=this.document.getElementById("DivWidth").value;
divObj.style.height=this.document.getElementById("DivHeight").value;
divObj.style.top=this.document.getElementById("DivTop").value;
divObj.style.left=this.document.getElementById("DivLeft").value;
divObj.style.background=this.document.getElementById("DivCorlor").value;
divObj.style.filter='alpha(opacity:'+this.document.getElementById("DivTM").value+')';
}
//-->
</script>
。
posted on 2008-07-30 10:38
依然
閱讀(281)
評論(0)
編輯
收藏
所屬分類:
javascript
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
動態加載javascript
js的className改變網頁class屬性
IE 和 FireFox 兼容性問題
javascript創建數組遇到的問題
利用javascript畫圓并拖動
event.button特性(網頁獲取鼠標事件)
javascirpt在網頁中添加控件
Powered by:
BlogJava
Copyright © 依然
主站蜘蛛池模板:
闸北区
|
金寨县
|
文化
|
乐业县
|
女性
|
沁源县
|
垫江县
|
呼玛县
|
平塘县
|
呼伦贝尔市
|
綦江县
|
会理县
|
日喀则市
|
永春县
|
志丹县
|
平罗县
|
岢岚县
|
诸暨市
|
石城县
|
垦利县
|
新民市
|
固安县
|
沧州市
|
怀柔区
|
博白县
|
兴义市
|
常州市
|
尼勒克县
|
安宁市
|
都昌县
|
连南
|
阳西县
|
鸡东县
|
墨玉县
|
台安县
|
吴江市
|
玉环县
|
阳东县
|
尼木县
|
民勤县
|
泽普县
|