0
내가 일하고 코드를 사용하지 않고하지 않습니다 내가 body
태그의 onload
이벤트와 함께 사용하면 코드가 완벽하게 작동 this-자바 스크립트 onload 이벤트
var winW;
if (document.body && document.body.offsetWidth) {
winW = document.body.offsetWidth;
}
if (document.compatMode=='CSS1Compat' &&
document.documentElement &&
document.documentElement.offsetWidth) {
winW = document.documentElement.offsetWidth;
}
if (window.innerWidth && window.innerHeight) {
winW = window.innerWidth;
}
if (winW = 1265) {
function setPosition()
{
document.getElementById("wblogo").style.left="1050px";
}
}
입니다.
하지만이 페이지를로드 할 때 사용하고 싶습니다. 그래서 다음 코드를 사용했습니다.
var winW;
if (document.body && document.body.offsetWidth) {
winW = document.body.offsetWidth;
}
if (document.compatMode=='CSS1Compat' &&
document.documentElement &&
document.documentElement.offsetWidth) {
winW = document.documentElement.offsetWidth;
}
if (window.innerWidth && window.innerHeight) {
winW = window.innerWidth;
}
if (winW = 1265) {
document.getElementById("wblogo").style.left="1050px";
}
그러나이 코드는 작동하지 않습니다. 도와주세요.
고맙습니다. 이것은 나를 도왔다! !! – sdnr1
@ sdnr1 : 좋은 거래! –