使用getElementsByTagName混淆 [英] Confused using getElementsByTagName

查看:85
本文介绍了使用getElementsByTagName混淆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿大家,

所以我整天都在互联网上试图帮助指导我创建一个使用ajax每隔4秒旋转一次内容的div并且我决定论坛帖子可能是最多的在这一点上有效。我的js脚本代码显然是当前的问题,我正在弄清楚如何构建数组来存储每个隐藏div的信息(class =" headline")。

展开 | 选择 | Wrap | 行号

解决方案

嗨...


欢迎来到TSDN ...


就我所知......剧本不会以任何方式奏效......对不起,我必须说......但没关系...让我们从头开始尝试,分析你所拥有的任务......请显示您正在使用的HTML,并告诉我们您如何填写隐藏的?与内容divs。然后告诉我们你的''旋转器' - 功能应该做什么......可能你不需要4个div ...只是一个用我们可能从列表中获取的内容更新的对象(被填充的对象)而不是4个div ... ...


亲切的问候......


这将是我工作的代码块。我的计划是让getElementsByTagName加载我所有的div然后从那里选择headline类中的那些div。通过for循环进入数组。从那里一个接一个地展示它们。我的主要问题是如何将它们加载到该阵列中但是如果你有更好的建议如何实现我在这里要做的事情请填写我(显然我对js有点新)。

展开 | 选择 | Wrap | 行号


嗯...


i看不到任何ajax-那里的代码...但让我总结一下。你有一些div并用PHP填充当前内容。我认为它们是隐藏的,所有这些都分配了className''标题'? ...现在你想每隔4秒显示其中一个......好吗?在网站生命周期中没有更新div的内容,不是吗?所以,当它不是,我是对的......你的想法并不是那么糟糕......你怎么隐藏divs - 它是在''标题'中宣布的 - 班级?


亲切的问候


hey everyone,
so ive been going around the internet all day trying to help guide me in creating a div that rotates content every 4 seconds using ajax and ive decided a forum post might be the most effective at this point. my js script code below is obviously and the current problem im having is figuring out how to build the array to store the information of each of the hidden divs (class = "headline").

Expand|Select|Wrap|Line Numbers

解决方案

hi ...

welcome to TSDN ...

as far as i can see ... the script wouldn''t work in any way ... sorry that i have to say that ... but it doesn''t matter ... lets try from the beginning, with an analysis of the task you have ... please show the html you are using and tell us how you fill the hidden? divs with content. then tell us exactly what your ''rotator''-function should do ... may be you don''t need 4 divs ... simply one that is updated with content that we might get from a list (object that was filled instead of 4 divs) ...

kind regards ...


This would be the block of code Im working from. My plan was to have the getElementsByTagName load all my divs then from there select the ones in the class of "headline". Into an array via the for loop. From there display them one after another. My main question was how to get them loaded into that array but if you have a better suggestion on how to achieve what I''m looking to do here please fill me in (obviously Im somewhat new to js).

Expand|Select|Wrap|Line Numbers


hmmm ...

i don''t see any ajax-code there ... but let me summarize. you have some divs and fill them in php with the current content. i assume they are hidden and all of them have the className ''headline'' assigned? ... now you want to display one of them every 4 seconds ...ok? there is no update of the content of the divs during site lifecycle or is it? so when its not and i''m right ... your idea wasn''t that bad ... how do you hide the divs - is it declared in the ''headline''-class?

kind regards


这篇关于使用getElementsByTagName混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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