JavaScript CSS html
3个span A B C,通过JS设置他的固定位置 window.onresize最好放到window.onload函数里边。
window.onload=login;
function login(){
var A= document.getElementById("A");
A.style.left = (document.documentElement.clientWidth-40)+"px";
var B= document.getElementById("B");
B.style.left = (document.documentElement.clientWidth-80)+"px";
var C= document.getElementById("C");
C.style.left = (document.documentElement.clientWidth-120)+"px";
window.onresize=login;
}
初步断定,你是不是禁用脚本了
初步断定,你是不是禁用脚本了
这个是正解啊,确实有这东西,我去选项里面设置了,没用
window.onresize最好放到window.onload函数里边。
window.onload=login;
function login(){
var A= document.getElementById("A");
A.style.left = (document.documentElement.clientWidth-40)+"px";
var B= document.getElementById("B");
B.style.left = (document.documentElement.clientWidth-80)+"px";
var C= document.getElementById("C");
C.style.left = (document.documentElement.clientWidth-120)+"px";
window.onresize=login;
}
现在的问题只是初始的时候只有css的效果,并没有login函数的效果。
测试了一遍,写到函数里面不会调用,调用的话也只是加载的时候调用一次
Copyright © 2019- axer.cn 版权所有 湘ICP备2023022495号-12
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务