问题 填空题

下图是用JavaScript编写的电子公告栏程序的执行效果,实现了预设消息的循环逐条发布。程序采用逐字延时的方式显示每条消息,模拟了类似打字机的效果。


[HTML文本]
<html>
<body>
<title>电子公告栏</title>
<script language=”JavaScript”>
var i = 0; // 表示从当前消息中提取的字符个数
var TextNumber = -1;// 当前所显示的消息的序号(取值范围0-7)
var TextInput = new Object(); // 存放消息的数组
TextInput[0] = “中科院发表全基因纠测序论文”;
TextInput[1] = “未来两天中东部地区各有降水,局部地区大幅降温”;
TextInput[2] = “俄一直升机执行任务时坠毁,机上12人可能全遇难”;
TextInput[3] = “美国宇航局:哥伦比亚号解体在返航时已经注定”;
TextInput[4] = “统计显示Google取代雅虎成为最大搜索服务网站”;
TextInput[5] = “挑战极限自然条件,联想昭阳勇攀珠峰!”;
TextInput[6] = “第一攻击手刘昌赫再试牛刀,力压李世右”;
TextInput[7] = “姚明击败奥尼尔大威,美刊非白人体育人士列第一”;
TotalTextInput = 8;
var HotText = “ ”; // 当前要显示的公告消息
var Text = “ “;// 目前已经滚动显示出的文字
var Speed = 50; // 显示速度
var TimerId;// 定时器标识
var TimerOn = false;// 定时标记
function nextMessage()// 显示下一条消息
if (!TimerOn)

TimerOn = true;
clearTimeout (TimerId);
TextNumber =  (1)  ; // 计算下一条消息在数组中的存放位置
document.forms[0].elements[1].value = TextNumber +1;
HotText =   (2)   ; // 当前待显示的消息
teletype();

function teletype()
if (TimerOn)

TimerId =   (3)   ;// 将消息写在消息框中
document.forms[0].elements[0].value =   (4)   ;

function rollMessage() // 从待显示的消息中提取前i 个字符返回给teletype()显示
i++;
var CheckSpace = HotText.substring(i-1,i);
CheckSpace = ““ + CheckSpace;
if (CheckSpace == “ “) i++;
if (i >= HotText.length + 1)

TimerOn = false;
Text = HotText.substring(0,i);
i = 0;
return (Text);

Text = HotText.substring(0,i);
return (Text);
</script>
</head>
<body>
<form>
<p align=”center”>电子公告栏</p>
<table>
<-- 中间省略网页结构性文档 -->
<input TYPE=”text” value=”共8条” SIZE=”5” name=”1”>
<input TYPE=”button” VALUE=”下一条” onClick=”   (5)   ”>
</table>
</form>
</body>
</html>

答案

参考答案:nextMessage( )

单项选择题
阅读理解

阅读理解

    For most people,shopping is still a matter of wandering down the street or loading a cart in a shopping mall.Soon,that will change. Electronic commerce (trade) is growing fast and will soon bring people more

choices.There will, however, be a cost:protecting the consumer from being cheated will be harder. Many

governments therefore want to apply strict regulations to the electronic world. But  politicians would be

wiser to see cyberspace as a basis for a new era of corporate selfregulation.

    Consumers in rich countries have grown used to the idea that the government takes responsibility for

everything from the stability of the banks to the safety of the drugs or their rights to refund when goods are

faulty.But governments cannot enforce national laws on businesses whose only presence is on the screen.

Even in a country where a clear right to compensation exists,the online customer in Tokyo,say,can hardly

go to New York to get a refund for a clothes purchase.

    One answer is for government to cooperate more:to recognize each other's rules.But that requires years

of work and volumes of detailed rules.And plenty of countries have rules too fanciful for sober countries to

accept.There is,however,another choice.Let the electronic businesses do the regulation themselves.They

do,after all,have a selfinterest in doing so.

   In electronic commerce,a reputation for honest dealing will be a valuable competitive asset.Governments,

too,may compete to be trusted.For instance,customers ordering medicines online may prefer to buy from

the United States because they trust the rigorous screening of the Food and Drug Administration;or they

may decide that the FDA's rules are too strict,and buy from Switzerland instead.

   Customers will still need to use their judgment.But precisely because the technology is new,electronic

shoppers are likely for a while to be a lot more cautious than customers of the normal sort.And the new

technology will also make it easier for them to complain when a company lets them down.In this way,at l

east,the advent of cyberspace may argue for fewer consumer protection laws,not more.

1.According to the author,what will be the best policy for electronic commerce?

A.Selfregulation by the businesses.

B.Strict consumer protection laws.

C.Close international cooperation.

D.Government protection

2.In case an electronic shopper bought faulty goods from a foreign country,what could he do?

A.Refuse to pay for the purchase.

B.Go to the seller and ask for a refund.

C.Appeal to consumer protection law.

D.Complain about it on the Internet.

3.In the author's view,businesses would place a high emphasis on honest dealing because in the

electronic world________.

A.international cooperation would be much more frequent

B.consumers could easily seek government protection

C.a good reputation is a great advantage in competition

D.it would be easy for consumers to complain

4.We can infer from the passage that in licensing new drugs the FDA in the United States is________.

A.very quick  

B.very cautious

C.very slow  

D.rather careless

5.If a customer buys something that does not meet his expectation,what is the advantage of dealing

through electronic commerce over the present normal one?

A.It will be easier for him to return the goods he is not satisfied with.

B.It will be easier for him to attain the refund from the seller.

C.It will be easier for him to get his complaints heard by other consumers.

D.It will be easier for him to complain about this to the government.