java - Automatically scroll to Element in HTML -


i have xml containing loads of test data. use xslt present data in html in browser. each test has table containing teststeps. every time test run table updates data in table if passed or not. browser reloads page. jump table working on @ moment. how can achieve this? xslt file:

<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform">  <xsl:template match="/"> <html>   <head>   <script type="text/javascript">       var testnum = 0;      if(document.cookie.indexof('testnum=') !== -1) {       testnum = document.cookie.split('testnum=')[1].split(';')[0];      document.cookie = 'testnum=' + testnum + 1 + ';expires=sat, 14 may 2015 18:00:00      gmt";';    } else {        document.cookie = 'testnum=1;expires=sat, 14 may 2015 18:00:00 gmt";';    }  var w = $(window); var row = $('#test').find('tr').eq( testnum );  if (row.length){     w.scrolltop( row.offset().top - (w.height()/2) ); }  </script>    <title>hmi automotive testing</title>   <link rel="stylesheet" type="text/css" href="report.css" />    </head>    <body>      <center>     <h1>hmi automotive testing</h1>        <br></br>       <div style="height:650px;width:824px;border:1px solid;overflow:auto;">              <table border="1" id ="test">             <xsl:for-each select= "testsuite/testcase">                          <tr>                         <b><xsl:value-of select="@name"/></b>                          </tr>                          <xsl:for-each select="verification|command">                                 <tr>                                 <xsl:choose>                                         <xsl:when test="contains(name() , 'verification')">                                          <td>verification <xsl:value-of select="@type"/></td>                                         <td><xsl:value-of select="@status"/></td>                                 </xsl:when>                                 <xsl:when  test="contains(name() , 'command')">                                         <td>command <xsl:value-of select="@type"/></td>                                         <td><xsl:value-of select="@status"/></td>                                 </xsl:when>                                 </xsl:choose>                                  </tr>                           </xsl:for-each>                </xsl:for-each>               </table>               </div>       </center>      </body>   </html>  </xsl:template>  </xsl:stylesheet>  

use id attribute.

<table id="result1"> ... </table> 

then if redirect page your_page.html#result1 browser scroll table.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -