擺渡人,外婆橋!
----只要路選對(duì)了,就不怕有多遠(yuǎn)!
javascript在IE和Firefox中的區(qū)別1
1.調(diào)用appendChild方法增加input對(duì)象,設(shè)置type屬性的位置
1
<
html
>
2
<
head
>
3
<
title
>
test
</
title
>
4
<
script
language
="javascript"
>
5
function
test()
{
6
var
tbodyElement
=
document.getElementById(
"
tbody1
"
);
7
var
trElement
=
document.createElement(
"
tr
"
);
8
var
idTDElement
=
document.createElement(
"
td
"
);
9
10
idTDElement.innerHTML
=
1
;
11
var
nameTDElement
=
document.createElement(
"
td
"
);
12
13
var
inputElement
=
document.createElement(
"
input
"
);
14
nameTDElement.appendChild(inputElement);
15
inputElement.type
=
"
button
"
;
16
//
在IE中,這句話將會(huì)拋出異常,但在firefox能正常運(yùn)行,如果type為text或者不設(shè)置type屬性,也都能正常運(yùn)行
17
inputElement.value
=
"
Invoke
"
;
18
/**/
/*
19
修改成下面的語句就能正常運(yùn)行:
20
var inputElement=document.createElement("input");
21
inputElement.type="button";
22
nameTDElement.appendChild(inputElement);
23
*/
24
25
tbodyElement.appendChild(trElement);
26
trElement.appendChild(idTDElement);
27
trElement.appendChild(nameTDElement);
28
}
29
</
script
>
30
</
head
>
31
<
body
>
32
<
input
type
="button"
value
="insert"
onclick
='test()'
>
33
<
table
cellpadding
="0"
cellspacing
="0"
border
="1"
>
34
<
tbody
id
='tbody1'
>
35
<
tr
>
36
<
td
width
="50"
>
ID
</
td
>
37
<
td
width
="200"
>
name
</
td
>
38
</
tr
>
39
</
tbody
>
40
</
table
>
41
</
body
>
42
</
html
>
2.appendChild一個(gè)radio對(duì)象,設(shè)置該對(duì)象的name屬性
1
var
nameTDElement
=
document.createElement(
"
td
"
);
2
var
radioElement
=
document.createElement(
"
input
"
);
3
radioElement.type
=
"
radio
"
;
4
nameTDElement.appendChild(inputElement);
5
radioElement.name
=
"
testRadioName
"
;
//
這句話在firefox是起作用的,但在IE下是不起作用的
6
/**/
/*
解決的辦法是
7
var radioElement=document.createElement("<input name='testRadioName'>");
8
radioElement.type="radio";
9
nameTDElement.appendChild(inputElement);
10
*/
3.對(duì)select控件增加和刪除Option
1
<
html
>
2
<
head
>
3
<
title
>
test
</
title
>
4
<
script
language
="javascript"
>
5
function
deleteRow()
{
6
var
selectElement
=
document.getElementById(
"
select1
"
);
7
selectElement.options.remove(
1
);
//
IE:OK Firefox:Failure
8
selectElement.remove(
1
);
//
IE:OK Firefox:OK
9
}
10
function
insertRow()
{
11
var
selectElement
=
document.getElementById(
"
select1
"
);
12
var
option
=
new
Option(
"
eeee
"
,
5
);
13
selectElement.add(option);
//
IE:OK Firefox:Failure
14
selectElement.options.add(option);
//
IE:OK Firefox:OK
15
}
16
</
script
>
17
</
head
>
18
<
body
>
19
<
input
type
="button"
value
="Delete"
onclick
='deleteRow()'
>
20
<
input
type
="button"
value
="Insert"
onclick
='insertRow()'
>
21
<
select
id
="select1"
>
22
<
option
value
="1"
>
aaa
</
option
>
23
<
option
value
="2"
>
bbb
</
option
>
24
<
option
value
="3"
>
ccc
</
option
>
25
<
option
value
="4"
>
ddd
</
option
>
26
</
select
>
27
</
body
>
28
</
html
>
發(fā)表于 2007-04-11 16:33
swingboat
閱讀(2322)
評(píng)論(6)
編輯
收藏
所屬分類:
javascript&DHTML&CSS
評(píng)論
#
re: javascript在IE和Firefox中的區(qū)別1[未登錄]
為什么我看過你的“在struts1.1框架下,利用smartupload實(shí)現(xiàn)文件的上傳(可以是多個(gè)文件) ”文章后,做了Action 接受上傳文件不行呢?
edwin
評(píng)論于 2008-06-03 19:11
回復(fù)
更多評(píng)論
#
re: javascript在IE和Firefox中的區(qū)別1[未登錄]
Action 如下:
public ActionForward loader(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
LoadFileForm loadFileForm = (LoadFileForm) form;
ActionForward forward = null;
//實(shí)例化上載bean
SmartUpload mySmartUpload = new SmartUpload();
String suc =null;
ServletConfig config = getServlet().getServletConfig();
try {
//初始化
mySmartUpload.initialize(getServlet().getServletConfig(),request, response);
//上載文件
mySmartUpload.upload();
} catch (ServletException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
} catch (SmartUploadException e1) {
e1.printStackTrace();
}
//獲取除文件以外的相關(guān)信息,例如upload.jsp中隱藏控件id的值
String strId=(String)mySmartUpload.getRequest().getParameter("id");
suc= "ok!!";
//String cnt=(String)request.getParameter("id");
//獲得總的文件數(shù)
Files files=mySmartUpload.getFiles();
//int count = mySmartUpload.getFiles().getCount();
//轉(zhuǎn)換為視圖
Collection col=files.getCollection();
//遍歷輸出
Iterator it=col.iterator();
String filePath = null;
String path =null;
while(it.hasNext()){
File file=(File)it.next();
//得到文件名
String oldFileName=file.getFileName();
//得到?jīng)]后輟的文件名
String name = oldFileName.substring(0, oldFileName.lastIndexOf('.'));
//得到文件大小
int fileSize = file.getSize();
//得到后輟
String extname=file.getFileExt();
//得到文件保存路徑
filePath = request.getRealPath("/jsp");
//拼成完整的保存路徑名
path = filePath +"/" +name +"_" +fileSize +"." +extname;
//String fileName=Sequence.getSequence()+"."+extname;//產(chǎn)生一個(gè)唯一的文件名
try {
file.saveAs(path);
} catch (IOException e) {
e.printStackTrace();
} catch (SmartUploadException e) {
e.printStackTrace();
}
}
request.setAttribute("suc",response);
forward = mapping.findForward("success");
return forward;
}
edwin
評(píng)論于 2008-06-03 19:14
回復(fù)
更多評(píng)論
#
re: javascript在IE和Firefox中的區(qū)別1[未登錄]
Jsp頁面如下:
<%@ page language="java" contentType="text/html;charset=gb2312"%>
<%@ taglib uri="
http://struts.apache.org/tags-bean"
prefix="bean"%>
<%@ taglib uri="
http://struts.apache.org/tags-html"
prefix="html"%>
<%@ taglib uri="
http://struts.apache.org/tags-logic"
prefix="logic"%>
<%@ taglib uri="
http://struts.apache.org/tags-tiles"
prefix="tiles"%>
<html>
<head>
<title>upload</title>
<style>
.lbtn {
font-family: verdana;
font-size: 10.5pt;
}
.ist {
font-family: verdana;
font-size: 14.8px;
size: 400
}
<!--
.STYLE2 {
font-size: 16px
}
.STYLE3 {
font-size: 36px;
font-weight: bold;
}
.STYLE4 {
color: #FFFFFF
}
body {
background-color: #99CCFF;
}
.STYLE9 {
font-size: 18px
}
-->
</style>
<script LANGUAGE="javascript">
function check(){
document.frm1.submit();
<!--document.body.innerHTML="Uploading Please wait!"; -->
}
var i=0;
function create(){
var sfrm = document.frm1.innerHTML;
var icnt = cnt.value;
for(j=0;j<icnt;j++)
{
sfrm = sfrm + "請(qǐng)選擇文件 "+i+" <input type=file name='file"+i+"' class=ist>";
sfrm = sfrm + " 路徑:<input type=text name='path"+i+"' value='' class=ist>";
sfrm = sfrm + "<br>";
i++;
}
document.frm1.innerHTML = sfrm;
document.frm1.cnt.value=i;
}
</script>
</head>
<body class=lbtn onload="document.frm1.cnt.value=cnt.value;">
<!-- 頁頭 -->
<jsp:include page="../../menu.jsp" />
<br>
<br>
<br>
<p align="center">
<span class="STYLE3">上 傳</span>
</p>
<logic:notEmpty name="suc">
<bean:write name="suc"/>
</logic:notEmpty>
<center>
請(qǐng)輸入要上傳文件的數(shù)量:
<input type=text name=cnt value="1" class=ist onchange="document.frm1.cnt.value=this.value;">
<input type=button name=bt1 value="生成上傳文件框" onclick="create();" class=lbtn>
<input type=button name=bt1 value="上傳" onclick="check();" class=lbtn>
<input type=button name=bt1 value="清除" onclick="document.location.reload();" class=lbtn>
<form name=frm1 method="post" encType="multipart/form-data" action="/dps_mj04/loadFile.do">
<input type=hidden name=cnt value="20" class=ist>
<input type = "hidden" name="status" value="loader">
<input type = "hidden" name="id" value="good">
</form>
<input type=button name=bt1 value="上傳" onclick="check();" class=lbtn>
<input type=button name=bt1 value="清除" onclick="document.location.reload();" class=lbtn>
</center>
</body>
</html>
edwin
評(píng)論于 2008-06-03 19:15
回復(fù)
更多評(píng)論
#
re: javascript在IE和Firefox中的區(qū)別1[未登錄]
經(jīng)過我的測(cè)試,問題是Action中:
//獲取除文件以外的相關(guān)信息,例如upload.jsp中隱藏控件id的值
String strId=(String)mySmartUpload.getRequest().getParameter("id");
//獲得總的文件數(shù)
Files files=mySmartUpload.getFiles();
得不到j(luò)sp頁中的數(shù)據(jù)。不知道為什么?jps
edwin
評(píng)論于 2008-06-03 19:21
回復(fù)
更多評(píng)論
#
re: javascript在IE和Firefox中的區(qū)別1[未登錄]
jsp頁面可以正常找到Action中的方法,執(zhí)行完后也可正常跳回本頁。
edwin
評(píng)論于 2008-06-03 19:23
回復(fù)
更多評(píng)論
#
re: javascript在IE和Firefox中的區(qū)別1[未登錄]
可以給我解答嗎?謝謝!!!
edwin
評(píng)論于 2008-06-03 19:25
回復(fù)
更多評(píng)論
新用戶注冊(cè)
刷新評(píng)論列表
只有注冊(cè)用戶
登錄
后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關(guān)文章:
IE對(duì)select的處理,又一怪現(xiàn)象:innerHTML竟然不起作用。
在IE下,頁面只有一個(gè)text的時(shí)候,回車將自動(dòng)submit。
設(shè)置input的內(nèi)容居中?
可惡的“本頁不但包含安全的內(nèi)容,也包含不安全的內(nèi)容。是否顯示不安全的內(nèi)容”對(duì)話框?
HTML的特殊字符
javascript在IE和Firefox中的區(qū)別1
利用div進(jìn)行頁面的布局2(position屬性)
利用div進(jìn)行頁面的布局1(float&clear屬性)
javascript轉(zhuǎn)換日期字符串為Date對(duì)象
Table中table-layout:fixed樣式的作用。
<
2007年4月
>
日
一
二
三
四
五
六
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
公告
導(dǎo)航
BlogJava
首頁
發(fā)新隨筆
發(fā)新文章
聯(lián)系
聚合
管理
統(tǒng)計(jì)
隨筆: 51
文章: 1
評(píng)論: 50
引用: 0
常用鏈接
我的隨筆
我的評(píng)論
我的參與
最新評(píng)論
留言簿
(4)
給我留言
查看公開留言
查看私人留言
隨筆分類
JAVA(21)
(rss)
javascript&DHTML&CSS(15)
(rss)
Oracle/MySQL(6)
(rss)
SOA(1)
(rss)
WEB2.0(4)
(rss)
WorkFlow&BPEL(1)
(rss)
名詞概念(1)
(rss)
架構(gòu)模式
(rss)
汽車&甲殼蟲
(rss)
設(shè)計(jì)模式(3)
(rss)
軟件工程(1)
(rss)
隨筆檔案
2007年9月 (1)
2007年8月 (3)
2007年7月 (1)
2007年5月 (2)
2007年4月 (4)
2007年3月 (1)
2007年2月 (1)
2006年12月 (1)
2006年11月 (2)
2006年10月 (1)
2006年8月 (1)
2006年4月 (1)
2006年3月 (2)
2006年2月 (4)
2005年12月 (26)
文章檔案
2006年1月 (1)
IT
竹筍炒肉
搜索
積分與排名
積分 - 133192
排名 - 466
最新隨筆
1.?IE對(duì)select的處理,又一怪現(xiàn)象:innerHTML竟然不起作用。
2.?在IE下,頁面只有一個(gè)text的時(shí)候,回車將自動(dòng)submit。
3.?設(shè)置input的內(nèi)容居中?
4.?可惡的“本頁不但包含安全的內(nèi)容,也包含不安全的內(nèi)容。是否顯示不安全的內(nèi)容”對(duì)話框?
5.?利用JGroups同步兩臺(tái)server之間的cache。
6.?有關(guān)“+”和“_”的search。
7.?synchronized的作用
8.?HTML的特殊字符
9.?不同時(shí)區(qū)之間,時(shí)間的轉(zhuǎn)換?
10.?javascript在IE和Firefox中的區(qū)別1
最新評(píng)論
1.?re: javascript轉(zhuǎn)換日期字符串為Date對(duì)象
大牛
--sfafa
2.?re: synchronized的作用[未登錄]
把100換成1000就好了!
--xyz
3.?re: synchronized的作用
晦澀難懂!
--無知者
4.?re: synchronized的作用
好
--白河夜歌
5.?re: 可惡的“本頁不但包含安全的內(nèi)容,也包含不安全的內(nèi)容。是否顯示不安全的內(nèi)容”對(duì)話框?
評(píng)論內(nèi)容較長,點(diǎn)擊標(biāo)題查看
--老梁
閱讀排行榜
1.?javascript轉(zhuǎn)換日期字符串為Date對(duì)象(47717)
2.?synchronized的作用(16409)
3.?可惡的“本頁不但包含安全的內(nèi)容,也包含不安全的內(nèi)容。是否顯示不安全的內(nèi)容”對(duì)話框?(11094)
4.?不同時(shí)區(qū)之間,時(shí)間的轉(zhuǎn)換?(7457)
5.?利用JGroups同步兩臺(tái)server之間的cache。(6607)
評(píng)論排行榜
1.?synchronized的作用(18)
2.?可惡的“本頁不但包含安全的內(nèi)容,也包含不安全的內(nèi)容。是否顯示不安全的內(nèi)容”對(duì)話框?(7)
3.?javascript在IE和Firefox中的區(qū)別1(6)
4.?javascript轉(zhuǎn)換日期字符串為Date對(duì)象(4)
5.?在IE下,頁面只有一個(gè)text的時(shí)候,回車將自動(dòng)submit。(3)
Powered by:
博客園
模板提供:
滬江博客
Copyright ©2025 swingboat
主站蜘蛛池模板:
亚洲欧洲日产国码www
|
国产成人免费A在线视频
|
国产婷婷成人久久Av免费高清
|
青青免费在线视频
|
成年女人男人免费视频播放
|
在线成人爽a毛片免费软件
|
美女隐私免费视频看
|
精品国产亚洲AV麻豆
|
久久不见久久见中文字幕免费
|
最近免费中文字幕高清大全
|
亚洲日韩看片无码电影
|
亚洲日韩av无码
|
成人午夜性A级毛片免费
|
免费可以在线看A∨网站
|
最近的中文字幕大全免费版
|
在线观看视频免费国语
|
国产乱子影视频上线免费观看
|
色欲色香天天天综合网站免费
|
亚洲av无码片区一区二区三区
|
亚洲成AV人网址
|
免费毛片a在线观看67194
|
国产福利在线观看永久免费
|
A毛片毛片看免费
|
污污网站18禁在线永久免费观看
|
最近免费中文字幕大全免费
|
国产卡二卡三卡四卡免费网址
|
精品亚洲永久免费精品
|
777爽死你无码免费看一二区
|
国产一卡二卡四卡免费
|
日本免费久久久久久久网站
|
免费视频精品一区二区
|
不卡视频免费在线观看
|
免费福利在线观看
|
国产在线播放线91免费
|
亚洲视频在线观看免费视频
|
性色av免费观看
|
亚洲日本韩国在线
|
亚洲美女视频免费
|
亚洲成AV人片在线观看ww
|
亚洲男人的天堂在线
|
亚洲视频一区网站
|