你的函数 getparam() 每次运行 document.myApplet.setValue(bb); 这个变量 bb 都被重新定义成了15, 不管这个变量以前是如何的. 是不是? 所以程序改一下:
function getparam()
{
document.myApplet.setValue(bb);
document.myApplet.repaint();
}
bb = new String("15"); //这句放到函数外来赋值, 这样只要这个变量有变化, 函数里的那个参数值也就跟着变化了.

解决方案 »

  1.   

    我试着这么做当我在我的静态HTML文本中改变BB的值再保存,然后看该页面的APPLET还是没变化,应该说setInterval("getparam();",2000);时钟将重新调用该函数,值已经变化但函数获取的值还是最初设置的值,当然如果刷新此网页值是传过来了,APPLET图形也变了,但我是要求动态变化不通过用户插入动作,APPLET根据传来的值画图。
    看来不是在外面赋值就行的,
      

  2.   

    setInterval("getparam();",2000);只会执行一次,在函数里面还要加上一句,类似递归
    function getparam(){
    bb = new String("15");
    document.myApplet.setValue(bb);
    document.myApplet.repaint();
             setInterval("getparam();",2000);
          }
      

  3.   


    Contents  Index  Topic Contents
     
    Previous Topic: setEndPoint
    Next Topic: setTimeout
     setInterval--------------------------------------------------------------------------------DescriptionRepeatedly evaluates an expression after a specified number of milliseconds has elapsed. Syntax
    intervalID = object.setInterval(expression, msec [, language])Parameter Description 
    expression  String containing the script code to execute each time the interval elapses. 
    msec  Integer value or numeric string specifying the length of the interval, in milliseconds. 
    language  Optional. String specifying the language in which the code is executed. Return ValueReturns an integer identifier representing the interval. Use this identifier to clear (stop) the interval. ExampleThe following example sets a 5-second interval. Each time the interval elapses, the background color of the document changes. setInterval("changeColor()", 5000);
       .
       .
       .
    function changeColor()
    {
      if (document.body.bgColor == "#ff0000")   // Check if body bgColor is red by comparing to hexidecimal value
          document.body.bgColor = "blue";
      else
          document.body.bgColor = "red";
    }Applies Towindow See Also
    clearInterval -------------------------------------------------------------------------------- Top of Page 
    © 1997 Microsoft Corporation. All rights reserved. Terms of Use. 
      

  4.   

    如果还不行,那就考虑是否hrong(黄蓉_逍遥拳修炼中) 说的问题