在页面刷新时旋转随机Div图层? [英] Rotate Random Div Layers on Page Refresh?

查看:78
本文介绍了在页面刷新时旋转随机Div图层?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道会在页面上旋转随机div图层的scipt

refresh?我在我的网站上有一个主要内容区域前面和中心

主页,我想每次调整各种html块(在div

图层中)用户重新加载页面。现在我正在求助

a随机图像旋转(这些脚本是一打一打)刷新,

但它远非理想我的东西我想要完成。任何帮助

都会非常感激!


Joey Stacks
jo ******** @ yahoo.com

解决方案

" ; Joey_Stacks" < jo ******** @ yahoo.com写了留言

新闻:11 ********************** @ y80g2000hsf.googlegr oups.com ...


有没有人知道会在页面上旋转随机div图层的scipt

refresh?我在我的网站上有一个主要内容区域前面和中心

主页,我想每次调整各种html块(在div

图层中)用户重新加载页面。现在我正在求助

a随机图像旋转(这些脚本是一打一打)刷新,

但它远非理想我的东西我想要完成。任何帮助

对此非常感激!



这样我就可以确定你要问的是什么...


你的意思是旋转,因为在切换之间说4个其他* DIV的4个当前DIV或者你的意思是

围绕某些东西旋转?


我刚从随机图像旋转中感到困惑并且旋转随机div层。


第一个听起来像是随机的,你顺时针或逆时针转动一些IMG

90度或者什么。


第二个对我来说就好像你要为4个DIV替换4个DIV(根据我以前的

例子),其中有类似的尚未确定(随机div层)。


-Lost


4月14日晚上10点26分, ; -Lost" < missed-s ... @ comcast.netwrote:


" Joey_Stacks" < joey_60 ... @ yahoo.com写了留言


新闻:11 ********************** @ y80g2000hsf.googlegr oups.com ...


有没有人知道会在页面上旋转随机div图层的scipt

refresh?我在我的网站上有一个主要内容区域前面和中心

主页,我想每次调整各种html块(在div

图层中)用户重新加载页面。现在我正在求助

a随机图像旋转(这些脚本是一打一打)刷新,

但它远非理想我的东西我想要完成。任何帮助

对此非常感激!



就这样我可以确定你要问的是什么...


你的意思是旋转,因为在切换之间说4个其他* DIV的4个当前DIV或者你的意思是

围绕某些东西旋转?


我刚从随机图像旋转中感到困惑并且旋转随机div层。


第一个听起来像是随机的,你顺时针或逆时针转动一些IMG

90度或者什么。


第二个对我来说就好像你要为4个DIV替换4个DIV(根据我以前的

例子),其中有类似的尚未确定(随机div层)。


-失去



我很乐意澄清。你知道人们如何在

刷新时轮换横幅广告?比如,在网站的顶部。每次刷新

页面时,不同的横幅广告都会显示在同一位置。有时

你会在连续刷新时看到相同的横幅,因为javascript

是完全随机的数学(我猜。)这就是我想要做的,只有

有div图层。所以这就是我要发生的事情。我正在设计一个

网站,并在900x300表格的主页前面和中心,我想要

旋转(刷新时)3个单独的营销信息与图形和

html文字。文本必须在图形的顶部,因此

需要div图层。知道了吗?


< div id =" d1" style =" display:none;"> some text 1< / div>

< div id =" d2" style =" display:none;"> some text 2< / div>

< div id =" d3" style =" display:none;"> some text 3< / div>


< script type =" text / javascript">

divs = [''d1'',''d2'',''d3''];


函数hideDivs(){

for (var i = 0; i< divs.length; i ++)

document.getElementById(divs [i])。style.display =''none'';

}


函数showDiv(){

hideDivs(); //在显示下一个之前隐藏它们。

var randomDiv = divs [Math.floor(Math.random()* divs.length)];

var div = document.getElementById(randomDiv).style.display =

''block'';


setTimeout(showDiv,500); //在显示下一个div之前设置延迟

}


showDiv();

< / script>

Does anyone know of a scipt that will rotate random div layers on page
refresh? I have a primary content area front and center on my site
homepage, and I''d like to rotate various chunks of html (in div
layers) each time a user reloads the page. Right now I''m resorting to
a random image rotation (those scripts are a dime a dozen) on refresh,
but it''s far from ideal for what I''m trying to accomplish. Any help
on this would be GREATLY appreciated!

Joey Stacks
jo********@yahoo.com

解决方案

"Joey_Stacks" <jo********@yahoo.comwrote in message
news:11**********************@y80g2000hsf.googlegr oups.com...

Does anyone know of a scipt that will rotate random div layers on page
refresh? I have a primary content area front and center on my site
homepage, and I''d like to rotate various chunks of html (in div
layers) each time a user reloads the page. Right now I''m resorting to
a random image rotation (those scripts are a dime a dozen) on refresh,
but it''s far from ideal for what I''m trying to accomplish. Any help
on this would be GREATLY appreciated!

Just so I can be sure of what you are asking...

You mean rotate as in switch between say 4 current DIVs for 4 *other* DIVs or did you mean
to rotate around something?

I just got confused from "random image rotations" and "rotate random div layers."

The first sounds like randomly, you turn some of the IMGs clockwise or counter- clockwise
by 90 degrees or something.

The second sounds to me as if you want to replace 4 DIVs for 4 DIVs (per my previous
example), the likes of which are undetermined ("random div layers").

-Lost


On Apr 14, 10:26 pm, "-Lost" <missed-s...@comcast.netwrote:

"Joey_Stacks" <joey_60...@yahoo.comwrote in message

news:11**********************@y80g2000hsf.googlegr oups.com...

Does anyone know of a scipt that will rotate random div layers on page
refresh? I have a primary content area front and center on my site
homepage, and I''d like to rotate various chunks of html (in div
layers) each time a user reloads the page. Right now I''m resorting to
a random image rotation (those scripts are a dime a dozen) on refresh,
but it''s far from ideal for what I''m trying to accomplish. Any help
on this would be GREATLY appreciated!


Just so I can be sure of what you are asking...

You mean rotate as in switch between say 4 current DIVs for 4 *other* DIVs or did you mean
to rotate around something?

I just got confused from "random image rotations" and "rotate random div layers."

The first sounds like randomly, you turn some of the IMGs clockwise or counter- clockwise
by 90 degrees or something.

The second sounds to me as if you want to replace 4 DIVs for 4 DIVs (per my previous
example), the likes of which are undetermined ("random div layers").

-Lost

I''d be happy to clarify. You know how people rotate banner ads on
refresh? Like, at the top of a web site. Each time you refresh the
page, a different banner ad shows up in the same spot. Sometimes
you''ll see the same banner on consecutive refreshes as the javascript
is completely random math (I guess.) That''s what I want to do, only
with div layers. So here''s what I''ve got going on. I''m designing a
site, and front and center on the homepage in a 900x300 table, I want
to rotate (on refresh) 3 seperate marketing messages with graphics and
html text. The text has to be on top of the graphic though, thus the
need to for div layers. Got it?


<div id="d1" style="display:none;">some text 1</div>
<div id="d2" style="display:none;">some text 2</div>
<div id="d3" style="display:none;">some text 3</div>

<script type="text/javascript">
divs = [''d1'',''d2'',''d3''];

function hideDivs() {
for (var i=0; i<divs.length; i++)
document.getElementById(divs[i]).style.display = ''none'';
}

function showDiv() {
hideDivs(); //hide them all before we show the next one.
var randomDiv = divs[Math.floor(Math.random()*divs.length)];
var div = document.getElementById(randomDiv).style.display =
''block'';

setTimeout(showDiv,500); //set a delay before showing the next div
}

showDiv();
</script>


这篇关于在页面刷新时旋转随机Div图层?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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