如何在VBScript中实现两点变速行走
在VBScript中,要实现两点均变速行走该如何编程呢?知道写这句的请私信,13975261050,有大红包。
set ie=wscript.createobject("internetexplorer.application","event_") '创建ie对象' ie.menubar=0 '取消菜单栏' ie.addressbar=0 '取消地址栏' ie.toolbar=0 '取消⼯具栏' ie.statusbar=0 '取消状态栏' ie.width=1360 ie.height=768 ie.resizable=0 '不允许改变' ie.navigate "about:blank" ie.left=fix((ie.document.parentwindow.screen.availwidth-ie.width)/2) '⽔平居中' ie.top=fix((ie.document.parentwindow.screen.availheight-ie.height)/2) '垂直居中' ie.visible=1 with ie.document '以下调document.write法,' .write "<html><head><style>div {width: 10px;height: 10px;margin: 10px;position: absolute;}#dot0 {background: #000; left: 10px;}#dot1 {background: rgb(51, 0, 255);top: 20px;left: 10px;}</style></head><body scroll=no>" '写段html到ie窗⼝中。' .write "<div id='dot0'></div><div id='dot1'></div>" .write "<script type='text/javascript'>" .write " a = 10.5;v1 = v2 = 1.5;" 'a 加速度,v初速度 .write "function go(id, v) {v += a;var t = document.getElementById(id).style;left = t.getPropertyValue('left').toString();left = isNaN(parseFloat(left)) ? 0 : parseFloat(left);t.setProperty('left', left + v + 'px');if (left > window.innerWidth){clearInterval(s1);alert('运行结束');}return v;}function setdo() {v1 = go('dot0', v1);v2 = go('dot1', v2);}" .write "s1 = setInterval(setdo, 100);" '100,时间间隔越小越快 .write "</script>" .write "</body></html>" end with