ActionScript 1.0 Flash Player 8 以上可以使用ExternalInterface.addCallback(methodName:String, instance:Object, method:Function) : Boolean
js调用flash方法
ExternalInterface.call(methodName:String, [parameter1:Object]) : Object
flash调用js方法
js调用flash方法
ExternalInterface.call(methodName:String, [parameter1:Object]) : Object
flash调用js方法
解决方案 »
- opera下用js点击按钮怎样获取选中部分的文本和html?
- 文本框 readonly也能修改
- 如何截取文件名?
- 在线等待-让下拉菜单项显示Tips
- **如何清空文件上传组件中的值?****
- 真诚求救:我遇到了一个大难题,可能对于大家来说不一定算什么,就是:我可以控制ie窗口右侧的滚动滑块么?以便使网页中一个弹出后非常长
- 怎么用javascript实现 gif或者swf动画按照指定的时间和坐标运动
- 高手指教!!!!!!!
- 一段js 求解含义
- 请问window.onbeforeunload与$(window).unload区别
- JS 图片切换
- JavaScript 图片移动缓冲技术, 寻求其Bug的解决方法?
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<input type="button" onclick="scroller(document.getElementById('a'),1000);return false;">移动到a</input>
<input type="button" onclick="scroller(document.getElementById('b'),1000);return false;">移动到b</input>
<p>
asdf<br>
asdf<br>
sadf<br>
asdf<br>
sadf<br>
sadf<br>
sadf<br>
asdf<br>
</p>
<a id="a" href="#">我是a</a>
<p>
asdf<br>
asdf<br>
sadf<br>
asdf<br>
sadf<br>
sadf<br>
sadf<br>
asdf<br>
</p>
<p>
asdf<br>
asdf<br>
sadf<br>
asdf<br>
sadf<br>
sadf<br>
sadf<br>
asdf<br>
</p>
<p>
asdf<br>
asdf<br>
sadf<br>
asdf<br>
sadf<br>
sadf<br>
sadf<br>
asdf<br>
</p>
<a id="b" href="#">我是b</a>
<p>
asdf<br>
asdf<br>
sadf<br>
asdf<br>
sadf<br>
sadf<br>
sadf<br>
asdf<br>
</p>
<p>
asdf<br>
asdf<br>
sadf<br>
asdf<br>
sadf<br>
sadf<br>
sadf<br>
asdf<br>
</p>
</body>
<script>
function scroller(el, duration)
{
if(typeof el != "object")
{
el = document.getElementById(el);
}
if(!el)
{
return;
}
var z = this;
z.el = el;
z.p = getPos(el);
z.s = getScroll();
z.clear = function(){
window.clearInterval(z.timer);z.timer = null;
};
z.t = (new Date).getTime();
z.step = function (){
var t = (new Date).getTime();
var p = (t - z.t) / duration;
if (t >= duration + z.t)
{
z.clear();
window.setTimeout(function(){
z.scroll(z.p.y, z.p.x);
}, 13);
}
else
{
st = ((-Math.cos(p * Math.PI) / 2) + 0.5) * (z.p.y - z.s.t) + z.s.t;
sl = ((-Math.cos(p * Math.PI) / 2) + 0.5) * (z.p.x - z.s.l) + z.s.l;
z.scroll(st, sl);
}
};
z.scroll = function (t, l){window.scrollTo(l, t);};
z.timer = window.setInterval(function(){z.step();}, 13);
}function getPos(e) {
var l = 0;
var t = 0;
var w = intval(e.style.width);
var h = intval(e.style.height);
var wb = e.offsetWidth;
var hb = e.offsetHeight;
while (e.offsetParent) {
l += e.offsetLeft + (e.currentStyle ? intval(e.currentStyle.borderLeftWidth) : 0);
t += e.offsetTop + (e.currentStyle ? intval(e.currentStyle.borderTopWidth) : 0);
e = e.offsetParent;
}
l += e.offsetLeft + (e.currentStyle ? intval(e.currentStyle.borderLeftWidth) : 0);
t += e.offsetTop + (e.currentStyle ? intval(e.currentStyle.borderTopWidth) : 0);
return {x:l, y:t, w:w, h:h, wb:wb, hb:hb};
} function getScroll() {
var t, l, w, h;
if (document.documentElement && document.documentElement.scrollTop) {
t = document.documentElement.scrollTop;
l = document.documentElement.scrollLeft;
w = document.documentElement.scrollWidth;
h = document.documentElement.scrollHeight;
} else {
if (document.body) {
t = document.body.scrollTop;
l = document.body.scrollLeft;
w = document.body.scrollWidth;
h = document.body.scrollHeight;
}
}
return {t:t, l:l, w:w, h:h};
}function intval(v) {
v = parseInt(v);
return isNaN(v) ? 0 : v;
}
</script>
</html>