帮助调试资源管理器 [英] Help debug for Explorer

查看:75
本文介绍了帮助调试资源管理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我是个脑袋,我没有办法制作这个小小的

脚本我在MSIE浏览器上正确编写了工作。

我知道这里很聪明,很容易发现我的f ** k和

告诉我我做错了什么。


代码在Firefox 1.5,Safari 2.0和Opera上运行得很好(有一些

小错误)


在资源管理器上,据我所知,它只是产生页面错误与神秘

错误消息。


任何人都可以帮助我吗?


脚本


[代码]

函数visaLager(id,width,height,speed,opacityTar)

{


//假冒速度转换以确保int值

var speeda = speed * 1


//获取图层

var el = document.getElementById(id);


//获取当前图层大小

var h_size1 = el.offsetHeight;

var v_size1 = el.offsetWidth;


//得到屏幕大小

if(self.innerWidth)

{

frameWidth = self.innerWidth;

frameHeight = self.innerHeight;

}

else if(document.documentElement&&

document.documentElement.clientWidth)

{

frameWidth = document.documentElement.clientWidth;

frameHeight = document.documentElement.clientHeight;

}

else if(document.body)

{

frameWidth = document.body.clientWidth;

frameHeight = document.body。 clientHeight;

}

var widthStepper = Math.round((width / 100)* speeda);

var heightStepper = Math.round( (身高/ 100)* speeda);


//循环循环

if(h_size1<宽度|| v_size1<高度)

{

//将图层居中

var topPos =((frameHeight / 2) - (h_size1 / 2))+ window .pageYOffset;

var leftPos =((frameWidth / 2) - (v_size1 / 2));


//确保我们该图层不覆盖猫

if(topPos< 200){topPos = 210; }


//这里我们放置图层

el.style.top = topPos +" px";

el.style.left = leftPos +" px";


if(h_size1< height)

{

/ /更新图层的高度

el.style.height =(h_size1 + heightStepper)+" px";

}

if (v_size1< width)

{

//更新图层的宽度

el.style.width =(v_size1 + widthStepper) +" px";

}

//不要在资源管理器中设置不透明度,只需将其设置为

if(!navigator.appName.match (微软))

{

if(el.style.opacity<(opacityTar / 100))

{

var opacity =((el.style.opacity * 10)+ 1)/ 10

el.style.opacity = opacity

}

} else {

el.style.filter =" alpha(opacity =" + opacityTar +")" ;;

} < br $>

//定义了获得甜蜜动画的超时时间效果

r = setTimeout(" visaLager(''" + id +"'',''" + width +"'',''" +身高+

"'',''" + speed +"'',''" + opacityTar +"'')",1);


} else {

//清除目标尺寸设置时的超时

clearTimeout(r)

}

}

[/ code]

解决方案

li ******** *****@gmail.com 写道:

由于我是个脑袋,我没有办法让这个小小的/>脚本我在MSIE浏览器上写了正确的工作。
我知道这里很聪明,很容易发现我的问题,并告诉我我做错了什么。

代码在Firefox 1.5,Safari 2.0和Opera上运行得很好(有一些小错误)

在资源管理器上,据我所知,它只是产生错误的页面错误
错误消息。

任何人都可以帮助我吗?


您好Daniel,


请允许我给您一些未经提及的建议。 ;-)


如果你想在网上发布任何东西,你别无选择。

你只需要得到一个W


-machine用IE来测试你的代码。


你如何在没有在IE4 / 5/6上测试的情况下发布你的页面?


你将不得不测试你的整个网站,而不仅仅是这个JS。

IE,firefox,opera,Safari等所有版本......它是太多了

太'猜测并且保持手指交叉''。


所以带上你的钱包,去买一些W

操作系统,并将其用作测试机。

或者去附近有IE运行的人。 (在我的

邻居中,人们使用的IE比我想要的人多,所以我希望它能够很难找到它。)


您不能指望该组的访问者为您进行测试。 : - /


另外,如果您对Javascript或CCS的好书感兴趣,我会建议:

- 动态HTML,明确的指南(SE)由O''Reilly

- Javascript,明确指南(第4版)也由O''Reilly


问候,

Erwin Moller


剧本




< snipped>


Since I''m a mac-head, I don''t have the possibility to make this little
script I wrote work proper on a MSIE browser.
I know there''s smarts in here that easily could spot my f**k ups and
tell me what I''m doing wrong.

Code works just fine on Firefox 1.5, Safari 2.0 and Opera (with some
minor buggs)

On explorer, as far as I know, it just produce page errors with cryptic
error messages.

Can anybody help me?

The script

[THE CODE]
function visaLager(id,width,height,speed,opacityTar)
{

// fakey speed convert to ensure int value
var speeda = speed*1

// fetch layer
var el = document.getElementById(id);

// get current size of layer
var h_size1 = el.offsetHeight;
var v_size1 = el.offsetWidth;

// get size of screen
if (self.innerWidth)
{
frameWidth = self.innerWidth;
frameHeight = self.innerHeight;
}
else if (document.documentElement &&
document.documentElement.clientWidth)
{
frameWidth = document.documentElement.clientWidth;
frameHeight = document.documentElement.clientHeight;
}
else if (document.body)
{
frameWidth = document.body.clientWidth;
frameHeight = document.body.clientHeight;
}
var widthStepper = Math.round((width/100) *speeda);
var heightStepper = Math.round((height/100) *speeda);

// the loop the loop
if (h_size1 < width || v_size1 < height)
{
//centers the layer
var topPos = ((frameHeight/2) - (h_size1/2)) + window.pageYOffset;
var leftPos = ((frameWidth/2) - (v_size1/2));

// ensures us that the layer doesnt cover the cats
if(topPos< 200) { topPos = 210; }

// and here we place the layer
el.style.top = topPos + "px";
el.style.left = leftPos + "px";

if(h_size1 < height)
{
// updates the height of the layer
el.style.height = (h_size1 + heightStepper) +"px";
}
if(v_size1 < width)
{
// updates the width of the layer
el.style.width = (v_size1 + widthStepper) +"px";
}
//dont animate opacity in Explorer, just set it
if(!navigator.appName.match("Microsoft"))
{
if(el.style.opacity < (opacityTar/100))
{
var opacity = ((el.style.opacity*10) + 1)/10
el.style.opacity=opacity
}
}else{
el.style.filter="alpha(opacity="+opacityTar+")";
}

// defines a timeout to get that sweet animated effect
r = setTimeout("visaLager(''" + id + "'',''" + width + "'',''" + height +
"'', ''" + speed +"'',''" + opacityTar + "'')", 1);

}else{
// clear the timeout when target size is set
clearTimeout(r)
}
}
[/code]

解决方案

li*************@gmail.com wrote:

Since I''m a mac-head, I don''t have the possibility to make this little
script I wrote work proper on a MSIE browser.
I know there''s smarts in here that easily could spot my f**k ups and
tell me what I''m doing wrong.

Code works just fine on Firefox 1.5, Safari 2.0 and Opera (with some
minor buggs)

On explorer, as far as I know, it just produce page errors with cryptic
error messages.

Can anybody help me?
Hi Daniel,

Allow me to give you a little unasked advise. ;-)

If you want to publish anything on the web, you have little choice.
You just NEED to get a W


-machine with IE to test your code.

How can you publish your pages without testing it on IE4/5/6 ??

You''ll have to test your whole site, not just this piece of JS.
IE, firefox, opera, Safari, etc in all their versions... It is just too much
too ''guess and keep fingers crossed''.

So take your wallet, go buy some W


OS, and use it as a testmachine.
Or go to somebody in your neighbourhood who has IE running. (In my
neighbourhood more people than I would like are using IE, so I expect it
won''t be hard to find one.)

You cannot expect the visitors of this group to do that testing for you. :-/

Futhermore, if you are interested in good books on Javascript or CCS, I
advise:
- Dynamic HTML, the definite Guide (SE) by O''Reilly
- Javascript, the definite Guide (4th edition) also by O''Reilly

Regards,
Erwin Moller


The script



<snipped>


这篇关于帮助调试资源管理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆