rendered paste body<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <style type="text/css" title="currentStyle" media="screen"> @import "../shared/css/test.css"; </style> <title>test</title> <script type="text/JavaScript"> ///Attaching a function on window.onload event. document.onload = function() /// On window load { var strCook = document.cookie; /// Get page cookie if(strCook.indexOf("!~")!= -1) /// if yPos cookie exists { var intS = strCook.indexOf("!~"); var intE = strCook.indexOf("~!"); var strPos = strCook.substring(intS+2,intE); /// get last Y position of the body document.body.scrollTop = strPos; /// restore the body to the previous Y scrolling position (WORKING) } ; document.getElementById('catalogue').onscroll = setScrollPos; /// This condition will set scroll position of <div>. document.getElementById('catalogue').onload = function() { if(strCook.indexOf("!*")!= -1) /// if divPos cookie exists { var intdS = strCook.indexOf("!*"); var intdE = strCook.indexOf("*!"); var strdPos = strCook.substring(intdS+2,intdE); /// get last Y position of the div document.getElementById('catalogue').scrollTop = strdPos; /// restore the catalogue div to the previous Y position (NON WORKING ?) } }; }; /// Function to set Scroll position of page before postback. function SetScrollPosition() { var intY = document.body.scrollTop; document.cookie = "yPos=!~" + intY + "~!"; }; ///This function sets the scroll position of div to cookie. function setScrollPos() { var divY = document.getElementById('catalogue').scrollTop; document.cookie = "divPos=!*" + divY + "*!"; }; /// Attaching SetScrollPosition() function to window.onscroll event. window.onscroll = SetScrollPosition; /// Attaching SetScrollPos() function to catalogue.onscroll event. </script> </head><body> <div id="principal"> <div id="showPhoto" style="height: 1000px;"> <h1>TEST</h1> </div> <div id="catalogue" style="height: 200px; overflow: auto;"> <table> <tr style="height: 85px;"> <td class="mini" align=center><a onClick="swap('../databank/checked/AlanCREVON2/DEMO3/PICT0037.jpg45b75833939ec.jpg')"><img src="../databank/checked/AlanCREVON2/DEMO3/t_PICT0037.jpg45b75833939ec.jpg" alt=""></a></td> <td class="ref" align=center> <strong>Ref :</strong> PICT0037.jpg</td> <td class="select"> <FORM action="test.html" method="POST"><p> <input type="hidden" name="addThisPhotoId" value="PICT0037.jpg45b75833939ec.jpg"> <input type="submit" name="bouton_submit" value=" Sélection "></p> </FORM> </td> <td class="selected" align=center> </td> </tr><tr style="height: 85px;"> <td class="mini" align=center><a onClick="swap('../databank/checked/AlanCREVON2/DEMO3/PICT0038.jpg45b75833a7809.jpg')"><img src="../databank/checked/AlanCREVON2/DEMO3/t_PICT0038.jpg45b75833a7809.jpg" alt=""></a></td> <td class="ref" align=center> <strong>Ref :</strong> PICT0038.jpg</td> <td class="select"> <FORM action="test.html" method="POST"><p> <input type="hidden" name="addThisPhotoId" value="PICT0038.jpg45b75833a7809.jpg"> <input type="submit" name="bouton_submit" value=" Sélection "></p> </FORM> </td> <td class="selected" align=center> </td> </tr><tr style="height: 85px;"> <td class="mini" align=center><a onClick="swap('../databank/checked/AlanCREVON2/DEMO3/PICT0039.jpg45b75833b0ade.jpg')"><img src="../databank/checked/AlanCREVON2/DEMO3/t_PICT0039.jpg45b75833b0ade.jpg" alt=""></a></td> <td class="ref" align=center> <strong>Ref :</strong> PICT0039.jpg</td> <td class="select"> <FORM action="test.html" method="POST"><p> <input type="hidden" name="addThisPhotoId" value="PICT0039.jpg45b75833b0ade.jpg"> <input type="submit" name="bouton_submit" value=" Sélection "></p> </FORM> </td> <td class="selected" align=center> </td> </tr><tr style="height: 85px;"> <td class="mini" align=center><a onClick="swap('../databank/checked/AlanCREVON2/DEMO3/PICT0042.jpg45b75833b8327.jpg')"><img src="../databank/checked/AlanCREVON2/DEMO3/t_PICT0042.jpg45b75833b8327.jpg" alt=""></a></td> <td class="ref" align=center> <strong>Ref :</strong> PICT0042.jpg</td> <td class="select"> <FORM action="test.html" method="POST"><p> <input type="hidden" name="addThisPhotoId" value="PICT0042.jpg45b75833b8327.jpg"> <input type="submit" name="bouton_submit" value=" Sélection "></p> </FORM> </td> <td class="selected" align=center> </td> </tr><tr style="height: 85px;"> <td class="mini" align=center><a onClick="swap('../databank/checked/AlanCREVON2/DEMO3/PICT0043.jpg45b75833c026f.jpg')"><img src="../databank/checked/AlanCREVON2/DEMO3/t_PICT0043.jpg45b75833c026f.jpg" alt=""></a></td> <td class="ref" align=center> <strong>Ref :</strong> PICT0043.jpg</td> <td class="select"> <FORM action="test.html" method="POST"><p> <input type="hidden" name="addThisPhotoId" value="PICT0043.jpg45b75833c026f.jpg"> <input type="submit" name="bouton_submit" value=" Sélection "></p> </FORM> </td> <td class="selected" align=center> </td> </tr><tr style="height: 85px;"> <td class="mini" align=center><a onClick="swap('../databank/checked/AlanCREVON2/DEMO3/PICT0044.jpg45b75833c8f5b.jpg')"><img src="../databank/checked/AlanCREVON2/DEMO3/t_PICT0044.jpg45b75833c8f5b.jpg" alt=""></a></td> <td class="ref" align=center> <strong>Ref :</strong> PICT0044.jpg</td> <td class="select"> <FORM action="test.html" method="POST"><p> <input type="hidden" name="addThisPhotoId" value="PICT0044.jpg45b75833c8f5b.jpg"> <input type="submit" name="bouton_submit" value=" Sélection "></p> </FORM> </td> <td class="selected" align=center> </td> </tr> </table> </div> </div></body></html>