将信息写入div [英] writing information to a div
问题描述
我写了一个小脚本,用div标签显示数据...要显示的数据每两秒钟就会改变一次。
我对这个脚本的问题是,在Internet Explorer中我得到一个错误预期的&b; [每次运行script.say时,每出现5次运行就不会发生此错误。尝试一次又一次刷新页面]。
在Firefox中
,没有显示任何内容......我对此感到难过!!
代码:
var名称;
var i = 0;
函数displaynames(name)
{
names = name.split(" ###");
heading.style.visibility =" visible";
heading.style.display =" block";
heading.innerText = names [i];
i = i + 1;
var t = setTimeout(''shownames()'',2000);
}
函数shownames()
{
if(i< names.length)
{
heading.innerText = names [i];
i = i + 1;
var t = setTimeout(''shownames()'',2000);
}
else
{
i = 0;
heading.innerText = names [i];
i = i + 1;
var t = setTimeout(''shownames()'',2000);
}
输入到displayn艾姆斯就是这种格式 - > 哇### yipee
任何帮助将不胜感激...
谢谢,
gomzi。
I have written a small script that will display data in a div tag ...the data to be displayed will change every two seconds.
The problem that i am having with this script is that,
in internet explorer i get an error "expected )" [This error does not occur every time i run the script.say once in every 5 runs it appears. Try refreshing the page again and again].
in firefox, nothing gets displayed...i am stumped on that!!
The code :
var names;
var i = 0;
function displaynames(name)
{
names = name.split("###");
heading.style.visibility="visible";
heading.style.display = "block";
heading.innerText = names[i];
i=i+1;
var t = setTimeout(''shownames()'',2000);
}
function shownames()
{
if (i<names.length)
{
heading.innerText = names[i];
i=i+1;
var t = setTimeout(''shownames()'',2000);
}
else
{
i=0;
heading.innerText = names[i];
i=i+1;
var t = setTimeout(''shownames()'',2000);
}
The input to displaynames is in this format -> "wow###yipee"
any help would be appreciated...
thanks,
gomzi.
推荐答案
嘿伙计......我想我对这里出了什么问题很了解......
我有一些像这样的字符串 - > windows xp''microsoft''在数据库中..
所以当我试图显示它们时,我得到一个错误,说预期'')''
>
即错误地将单引号视为字符串的结尾...
无论如何我还能克服这个问题吗?
hey guys...i think i have got a pretty good idea of whats going wrong here...
I have some strings like this-> windows xp ''microsoft'' in the database..
so when am trying to display them, i get an error saying expected '')''
i.e. it wrongly considers the single quote as the end of the string...
is there anyway how i can overcome this?
嗨朋友
首先你最后错过了一个}
!!!
而不是使用
i = i + 1;
使用
i ++;
i可以帮助你,当我明白你想要它的方式。!
所以你有一个文本框用于输入由###
分隔的名字,你想要每2秒写一个div />
或
你有一系列的名字吗?
你想要每2秒写一个div
>
我很好奇
peace
hi pal
first u are missin a }
at the very end!!!
and instead of using
i=i+1;
use
i++;
i can help u with it ,when i understand the way u want it.!
so do u have an textbox for entering names seperated by ###
and u want to write them in a div every 2 sec
Or
do u have an array of names?
and u want to write them in a div every 2 sec
im curious
peace
hi pal
first你最后会错过}
!!!
>
而不是使用
i = i + 1;
使用
i ++;
i can当我理解你想要它的方式时帮助你。!
所以你有一个文本框用于输入由###
分隔的名字,你想写他们每隔2秒在一个div中
或者
你有一系列名字吗?
你想把它们写成div 2秒
我好奇
和平
hi pal
first u are missin a }
at the very end!!!
and instead of using
i=i+1;
use
i++;
i can help u with it ,when i understand the way u want it.!
so do u have an textbox for entering names seperated by ###
and u want to write them in a div every 2 sec
Or
do u have an array of names?
and u want to write them in a div every 2 sec
im curious
peace
感谢队友....
ya。我有}最后..忘了把它复制到这里。
我有一系列的名字。这些名称已经通过分隔它们被放入数组中了....即说tom ### jerry已被放入数组中的两个位置,一个包含tom和另一个jerry。
thanks mate....
ya. i have the } at the end..forgot to copy it here.
i have an array of names. These names have been put into the array by separating them .... i.e. say tom###jerry has been put into two positions in an array , one containing tom and the other jerry.
这篇关于将信息写入div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!