Twansparant
Nieuwe gebruiker
- Lid geworden
- 22 feb 2007
- Berichten
- 4
Hallo,
Ik heb een probleempje met een Javascript waar ik niet uitkom.
Ik gebruik een soort uitklapfunctie op een site waarbij je extra informatie over een boek kunt uitklappen en weer dichtklappen. Dit werkt prima, echter als je een boek 'openlaat' en eronder een nieuwe aanklikt, opent deze zich op de hoogte waar de vorige dichtklapt (alleen eronder, erboven gaat wel goed). Volgens mij heeft dit iets met het "scrollIntoView" te maken, maar ik heb te weinig verstand van Javascripting om dit te veranderen. Kan iemand mij hiermee helpen?
Mijn javascript:
En mijn HTML bron (ingekort):
Mijn dank is groot! :thumb:
Ik heb een probleempje met een Javascript waar ik niet uitkom.
Ik gebruik een soort uitklapfunctie op een site waarbij je extra informatie over een boek kunt uitklappen en weer dichtklappen. Dit werkt prima, echter als je een boek 'openlaat' en eronder een nieuwe aanklikt, opent deze zich op de hoogte waar de vorige dichtklapt (alleen eronder, erboven gaat wel goed). Volgens mij heeft dit iets met het "scrollIntoView" te maken, maar ik heb te weinig verstand van Javascripting om dit te veranderen. Kan iemand mij hiermee helpen?
Mijn javascript:
Code:
lastObj=0;
function servOC(i, href, nColor) {
var trObj = (document.getElementById) ? document.getElementById('ihtr' + i) : eval("document.all['ihtr" + i + "']");
var nameObj = (document.getElementById) ? document.getElementById('name' + i) : eval("document.all['name" + i + "']");
var urlObj = (document.getElementById) ? document.getElementById('linkje' + i) : eval("document.all['linkje" + i + "']");
var ifObj = (document.getElementById) ? document.getElementById('ihif' + i) : eval("document.all['ihif" + i + "']")
if (trObj != null) {
if (trObj.style.display=="none") {
trObj.style.display="";
urlObj.className=('author-content');
if (!ifObj.src) {ifObj.src = href;}
((document.getElementById) ? document.getElementById('ihif'+i) : eval("document.all['ihif" + i + "']")).style.height = "";
}
else {
urlObj.className=('');
((document.getElementById) ? document.getElementById('ihif'+i) : eval("document.all['ihif" + i + "']")).style.height = "0px";
((document.getElementById) ? document.getElementById('ihtr' + i) : eval("document.all['ihtr" + i + "']")).style.display="none";
}
}
if(lastObj && lastObj!=i){
var oldurlObj = (document.getElementById) ? document.getElementById('linkje' + lastObj) : eval("document.all['linkje" + lastObj + "']");
oldurlObj.className=('');
((document.getElementById) ? document.getElementById('ihif'+lastObj) : eval("document.all['ihif" + lastObj + "']")).style.height = "0px";
((document.getElementById) ? document.getElementById('ihtr' + lastObj) : eval("document.all['ihtr" + lastObj + "']")).style.display="none";
}
lastObj=i;
}
En mijn HTML bron (ingekort):
HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Books</title>
</head>
<link href="books.css" rel="stylesheet" type="text/css" />
<script src="functions.js" type="text/javascript" language="javascript"></script>
<script language="javascript">theprojects=new Array(25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1);</script>
<body>
<table width="440" border="0" align="left" cellpadding="0" cellspacing="0">
<noscript>
<tr>
<td bgcolor="#FFCCCC" class="javawarning">
<b>It seems this browser does not support JavaScript or has JavaScript disabled
in its settings. For full functionality in this booksection, please enable
JavaScript and refresh this page.</b></td>
</tr>
<tr>
<td height="5" class="javawarning"> </td>
</tr>
</noscript>
<td align="left" valign="top" class="author-content">
<p>BOOKS<br>
<em>click titles to open & close information</em><br>
<br>
</p>
</td>
</tr>
<tr>
<td id="name25" class="author-content">
<span style="font-weight: bold">
<a onMouseUp="scrollIntoView(true)"
href="thumbs/thumb25.html" target="image" id="linkje25"
onclick='servOC(25,"detailpages/book25.html","#12112B");return true'>
The Family Business on the Couch: A Psychodynamic-Systems Perspective</a></span><br>
By Manfred Kets de Vries & Randel Carlock, with Elizabeth Florent-Treacy (2007)</td>
</tr>
<tr style="display: none;" id="ihtr25">
<td class="author-content">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tbody><tr>
<td>
</br>
<iframe id="ihif25" frameborder="0" height="470px" width="100%"></iframe> </td>
</tr>
</tbody></table> </td>
</tr>
<tr>
<td id="name24" class="author-content">
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br>
<span style="font-weight: bold">
<a onMouseUp="scrollIntoView(true)"
href="thumbs/thumb24.html" target="image" id="linkje24"
onclick='servOC(24,"detailpages/book24.html","#12112B");return true'>
Coach and Couch: The Psychology of Making Better Leaders</a></span><br>
Edited by Manfred F.R. Kets de Vries, Konstantin Korotov, and Elizabeth Florent-Treacy (2007)</td>
</tr>
<tr style="display: none;" id="ihtr24">
<td class="author-content">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tbody><tr>
<td>
</br>
<iframe id="ihif24" frameborder="0" height="325px" width="100%"></iframe> </td>
</tr>
</tbody></table> </td>
</tr>
<td id="name23" class="author-content">
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br>
<span style="font-weight: bold">
<a onMouseUp="scrollIntoView(true)"
href="thumbs/thumb23.html" target="image" id="linkje23"
onClick='servOC(23,"detailpages/book23.html","#12112B");true'>
The Leader on the Couch:<br>
A Clinical Approach to Changing People & Organizations</a></span><br>
By Manfred F.R. Kets de Vries (2006)</td>
</tr>
<tr style="display: none;" id="ihtr23">
<td class="author-content">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td></br>
<iframe id="ihif23" frameborder="0" height="550px" width="100%"></iframe> </td>
</tr>
</tbody></table> </td>
</tr>
</table>
</body>
</html>
Mijn dank is groot! :thumb:
Laatst bewerkt: