可扩展的divs问题冗长的页面 [英] expandable divs question for lengthy page

查看:84
本文介绍了可扩展的divs问题冗长的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下脚本进行扩展div,但是...焦点位于页面顶部,即div ID #quiz,我试图使用if for a冗长的FAQ页面。

当你滚动到页面底部并打开一个问题时,焦点会弹回到页面顶部。

我想要定义几个部分,但是当我只做一个是折叠的,其他的是在页面加载时打开

I am using the following script for expandable divs but ...the focus is on the top of the page ie..the div id #quiz, and I am trying to use if for a lengthy FAQ page.
when you scroll to the bottom of the page and open a question, the focus pops back to the top of the page.
I thought of defining several sections, but when I do only one is collapsed, the others are open on page load

展开 | 选择 | Wrap | 行号

推荐答案


我正在使用以下脚本用于可扩展div但是......焦点位于页面顶部,即... div id #quiz,我试图使用if用于冗长的FAQ页面。

when滚动到页面底部并打开一个问题,焦点会弹回到页面顶部。

我想要定义几个部分,但是当我只做一个部分时会崩溃,其他部分在页面加载时打开


< script language =" JavaScript"类型= QUOT;文本/ JavaScript的">

缩进= 5; //这里设置左缩进(以像素为单位)

iup =''images / blueup.gif''//在这里设置向上箭头相对位置

idrop =''images / bluedrop.gif''//在这里设置下拉箭头相对位置

//无需在下面修改

function coll(){

var dd = document.getElementById(''quiz'')。getElementsByTa gName(''div'');

var aa = document.getElementById(''quiz'')。getElementsByTa gName(''im'');

for(var i = 1; i< dd.length; i = i + 2){

dd [i] .style.position =''relative'' ;

dd [i] .style.display =''none'';

dd [i] .style.left = indent +''px'';

}

for(var j = 0; j< aa.length; j ++){

im = aa [j] .getAttribute( '' SRC '');

if(im == idrop){

aa [j] .setAttribute('src'',iup); break

}

}

}

函数激活(w){

var d = w.parentNode.getElementsByTagName(' 'DIV'')[0];

var a = w.firstChild;

if(d.style.display ==''none''){

coll();

d.style.display =''inline'';

a.setAttribute(''src'',idrop);

}

else {

d.style.display =''none'';

a.setAttribute(''src'',iup);

}

}

onload = coll;

< / script>

http://www.nmprc.state.nm.us/ftalfaq2.htm



Java!= Javascript


已移至Javascript论坛


Java != Javascript

Moved to Javascript forum


您所在的任何地方
Everywhere where you have
展开 | 选择 | 换行 | 行号


非常感谢你,我是java的新手,我可以使用已编写的脚本,但是当它不起作用时不知道修复它。

再次感谢,它ks完美现在:)
thank you so much, I am very new to java, I can use an already written script, but do not know enough to fix it when it doesn''t work.
thanks again, it works perfectly now :)


这篇关于可扩展的divs问题冗长的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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