功能在Safari中不起作用 [英] Function doesnt work in Safari
问题描述
我编写了以下功能,并在MSIE,Firefox和Mac中进行了测试
Safari,除了Safari之外的所有功能。我该怎么做才能纠正这个问题?
函数processBackground(){for(n = 1; n< 11; n ++)
{
cellrow =" r" + n
for(i = 1; i< 17; i ++){
cell = cellrow +" ; w" + i
cellName = cell +" _ID"
thisForm = document.forms [0]
if(document.all [cell] .value ===" X"){
document.all [cellName] .style.backgroundColor =''#84DFC1''
}
}
}
}
I wrote the following function and tested it in MSIE, Firefox and Mac
Safari, Works in all but the Safari. What can I do to rectify this?
function processBackground(){ for (n=1;n<11;n++)
{
cellrow="r"+n
for (i=1;i<17;i++){
cell=cellrow+"w"+i
cellName=cell+"_ID"
thisForm=document.forms[0]
if (document.all[cell].value==="X"){
document.all[cellName].style.backgroundColor=''#84DFC1''
}
}
}
}
推荐答案
ef*****@epitome.com.sg < ef ***** @ epitome.com。 sgwrote:
ef*****@epitome.com.sg <ef*****@epitome.com.sgwrote:
我编写了以下函数并在MSIE,Firefox和Mac中进行了测试
Safari,除了Safari之外的所有工作。我该怎么做才能纠正这个问题?
函数processBackground(){for(n = 1; n< 11; n ++)
{
cellrow =" r" + n
for(i = 1; i< 17; i ++){
cell = cellrow +" w" + i
cellName = cell +" _ID"
thisForm = document.forms [0]
if(document.all [cell]。值===" X"){
document.all [cellName] .style.backgroundColor =''#84DFC1''
}
}
}
}
I wrote the following function and tested it in MSIE, Firefox and Mac
Safari, Works in all but the Safari. What can I do to rectify this?
function processBackground(){ for (n=1;n<11;n++)
{
cellrow="r"+n
for (i=1;i<17;i++){
cell=cellrow+"w"+i
cellName=cell+"_ID"
thisForm=document.forms[0]
if (document.all[cell].value==="X"){
document.all[cellName].style.backgroundColor=''#84DFC1''
}
}
}
}
Safari不知道document.all对象。所以这个函数将不会与Safari一起工作。
../otto
Safari doesn''t know about the document.all object. So this function will
not work with Safari.
../otto
Otto Lang写道:
Hi,
Otto Lang wrote:
ef *****@epitome.com.sg < ef ***** @ epitome.com.sgwrote:
ef*****@epitome.com.sg <ef*****@epitome.com.sgwrote:
>我写的以下功能并在MSIE,Firefox和Mac中进行了测试
Safari,除了Safari之外的所有功能。我该怎么做才能纠正这个问题?
函数processBackground(){for(n = 1; n< 11; n ++)
{
cellrow =" r" + n
for(i = 1; i< 17; i ++){
cell = cellrow +" w" + i
cellName = cell +" _ID"
thisForm = document .forms [0]
if(document.all [cell] .value ===" X"){
document.all [cellName] .style.backgroundColor =''#84DFC1''
}
}
}
>I wrote the following function and tested it in MSIE, Firefox and Mac
Safari, Works in all but the Safari. What can I do to rectify this?
function processBackground(){ for (n=1;n<11;n++)
{
cellrow="r"+n
for (i=1;i<17;i++){
cell=cellrow+"w"+i
cellName=cell+"_ID"
thisForm=document.forms[0]
if (document.all[cell].value==="X"){
document.all[cellName].style.backgroundColor=''#84DFC1''
}
}
}
}
Safari不知道document.all对象。所以这个函数将不会与Safari一起工作。
./otto
Safari doesn''t know about the document.all object. So this function will
not work with Safari.
./otto
要制作你的回复更好,你可以建议使用
document.getElementById代替;-)
HTH,
Laurent
To make your reply even better, you could have suggested using
document.getElementById instead ;-)
HTH,
Laurent
Laurent Bugnion写道:
Laurent Bugnion wrote:
>
Otto Lang写道:
Hi,
Otto Lang wrote:
ef ***** @ epitome .com.sg < ef ***** @ epitome.com.sgwrote:
ef*****@epitome.com.sg <ef*****@epitome.com.sgwrote:
我编写了以下函数并在MSIE中对其进行了测试, Firefox和Mac
Safari,适用于除Safari之外的所有功能。我该怎么做才能纠正这个问题?
函数processBackground(){for(n = 1; n< 11; n ++)
{
cellrow =" r" + n
for(i = 1; i< 17; i ++){
cell = cellrow +" w" + i
cellName = cell +" _ID"
thisForm = document.forms [0]
if(document.all [cell]。值===" X"){
document.all [cellName] .style.backgroundColor =''#84DFC1''
}
}
}
}
I wrote the following function and tested it in MSIE, Firefox and Mac
Safari, Works in all but the Safari. What can I do to rectify this?
function processBackground(){ for (n=1;n<11;n++)
{
cellrow="r"+n
for (i=1;i<17;i++){
cell=cellrow+"w"+i
cellName=cell+"_ID"
thisForm=document.forms[0]
if (document.all[cell].value==="X"){
document.all[cellName].style.backgroundColor=''#84DFC1''
}
}
}
}
Safari不知道document.all对象。所以这个函数将不会与Safari一起使用
。
./otto
Safari doesn''t know about the document.all object. So this function will
not work with Safari.
./otto
要制作你的回复更好,你可以建议使用
document.getElementById代替;-)
HTH,
Laurent
To make your reply even better, you could have suggested using
document.getElementById instead ;-)
HTH,
Laurent
Lauren
我试过了,我也改了代码使用
document.form [0] .element [cell]但仍遇到问题。
Lauren
I tried tthat and I also changed the code to use
document.form[0].element[cell] but still ran into problem.
这篇关于功能在Safari中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!