依然的小屋
導(dǎo)航
BlogJava
首頁
新隨筆
聯(lián)系
聚合
管理
統(tǒng)計(jì)
隨筆 - 1
文章 - 46
評論 - 82
引用 - 0
常用鏈接
我的隨筆
我的文章
我的評論
我的參與
最新評論
留言簿
(5)
給我留言
查看公開留言
查看私人留言
隨筆檔案
(1)
2009年4月 (1)
文章分類
(37)
Ajax學(xué)習(xí)筆記
(rss)
css(2)
(rss)
DWR(1)
(rss)
Google Map API 學(xué)習(xí)(3)
(rss)
Html
(rss)
javascript(7)
(rss)
Java基礎(chǔ)知識惡補(bǔ)篇(9)
(rss)
jstl(1)
(rss)
oracle(3)
(rss)
photoshop(1)
(rss)
spring(1)
(rss)
tomcat(1)
(rss)
webservice(3)
(rss)
心情日記(1)
(rss)
正則表達(dá)式(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)
友情鏈接
子貓の部屋
負(fù)罪者
搜索
最新評論
1.?re: WebSphere 部署的問題[未登錄]
請問在AIX系統(tǒng)里部署應(yīng)用時(shí)systemerr反饋了ClassNotFound ,WAS6.1是在哪里配置
--Season
2.?re: js的className改變網(wǎng)頁class屬性
多謝 我也不知道
--fd
javascirpt在網(wǎng)頁中添加控件
javascript不是很難,但添加控件的事件如onclick等,要用attachEvent('onclick',調(diào)用的函數(shù)),不過這只是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="創(chuàng)建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
依然
閱讀(283)
評論(0)
編輯
收藏
所屬分類:
javascript
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發(fā)表評論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關(guān)文章:
動(dòng)態(tài)加載javascript
js的className改變網(wǎng)頁class屬性
IE 和 FireFox 兼容性問題
javascript創(chuàng)建數(shù)組遇到的問題
利用javascript畫圓并拖動(dòng)
event.button特性(網(wǎng)頁獲取鼠標(biāo)事件)
javascirpt在網(wǎng)頁中添加控件
Powered by:
BlogJava
Copyright © 依然
主站蜘蛛池模板:
申扎县
|
泽库县
|
苍梧县
|
乐业县
|
麻栗坡县
|
开远市
|
武陟县
|
蒙山县
|
五台县
|
四会市
|
河北省
|
揭东县
|
吉林省
|
晋宁县
|
齐齐哈尔市
|
涟水县
|
南乐县
|
丹江口市
|
曲靖市
|
堆龙德庆县
|
正蓝旗
|
瑞昌市
|
江西省
|
行唐县
|
安塞县
|
东兰县
|
太仆寺旗
|
锡林浩特市
|
沧州市
|
新津县
|
常熟市
|
德清县
|
长武县
|
高邮市
|
松潘县
|
吉隆县
|
通榆县
|
奇台县
|
洞头县
|
汤阴县
|
潢川县
|