右表始终在 XSL 的窗口中居中
Right Table centered always in window in XSL
我尝试寻找这个答案,并看到接近它的问题,但无法解决我的问题@查看大表时,HTML表格标题始终显示在窗口顶部。
基本上,我们继承了一个具有 2 个 HTML 表的 XSL 页面,当您将鼠标悬停在主表上值为"yes"的行上时,它会在右侧显示与该行相关的隐藏的第二个表,而如果"否",则不显示任何内容。但是,如果通过 XSL 显示大量结果,则向下滚动时将无法看到该表。
我只是想知道是否有办法强制 1 右侧隐藏表每次将鼠标悬停在值上时都停留在屏幕顶部是,即使这意味着将 XSL 结果设置为具有滚动条?
希望我已经说清楚了,请参阅我遇到问题的代码摘录。
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<script>
function showme(show)
{
<xsl:for-each select="root/Action">document.getElementById('<xsl:value-of select="@Type"/>').style.display='none';
</xsl:for-each>
document.getElementById('summary').style.display='none';
document.getElementById(show).style.display='inline';
}
</script>
<xsl:for-each select="root/Action">
<span style="display:none">
<xsl:attribute name="id"><xsl:value-of select="@Type"/></xsl:attribute>
<table class="lgreenback"><tr class="small"><td class="green">Details for: <b><xsl:value-of select="@Type"/> Actions:</b>   <a onmouseover="style.cursor='hand'" onclick="showme('summary')"><< Back</a></td></tr></table><br/>
<table cellspacing="0" cellpadding="2" class="bdrnw">
<tr class="small">
<td class="lgheadercell">Date:</td>
<td class="lgheadercell"> </td>
<td class="lgheadercell">Time:</td>
<td class="lgheadercell"> </td>
<td class="lgheadercell">Done By:</td>
<td class="lgheadercell"> </td>
<td class="lgheadercell">B&S Ref:</td>
<td class="lgheadercell"> </td>
<td class="lgheadercell">Assocs:</td>
</tr>
<xsl:for-each select="Case">
<tr class="smallerstill">
<xsl:choose>
<xsl:when test="count(Linked) > 0">
<xsl:attribute name="onmouseover">style.background='#f6f6f6', style.cursor='hand', document.getElementById('<xsl:value-of select="@id"/>').style.display='inline'</xsl:attribute>
<xsl:attribute name="onmouseout">style.background='#ffffff', document.getElementById('<xsl:value-of select="@id"/>').style.display='none'</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="onmouseover">style.background='#f6f6f6', style.cursor='hand'</xsl:attribute>
<xsl:attribute name="onmouseout">style.background='#ffffff'</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<td><xsl:value-of select="Date"/></td>
<td></td>
<td><xsl:value-of select="Time"/></td>
<td></td>
<td><xsl:value-of select="Realname"/></td>
<td></td>
<td><xsl:value-of select="substring(Client,1,3)" />-<xsl:value-of select="substring(Client,4,1)" /> <xsl:value-of select="Ref"/></td>
<td></td>
<td align="center">
<xsl:choose>
<xsl:when test="count(Linked) > 0">Yes</xsl:when>
<xsl:otherwise>No</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:for-each>
</table>
</span>
</xsl:for-each>
</td><td valign="top" align="left">
<img src="../images/spacer.gif" height="41" width="120"/>
<xsl:for-each select="/root/Action/Case[count(Linked) > 0]">
<span style="display:none">
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
<table cellspacing="0" cellpadding="2" class="bdrnw">
<tr class="small"><td class="lgheadercell">Assocs:</td></tr>
<xsl:for-each select="Linked">
<tr class="smallerstill"><td><xsl:value-of select="substring(@cl,1,3)" />-<xsl:value-of select="substring(@cl,4,1)" /> <xsl:value-of select="@nm"/></td></tr>
</xsl:for-each>
</table>
</span>
</xsl:for-each>
</td></tr></table>
</html>
</xsl:template>
</xsl:stylesheet>
如果您需要其他任何东西,请告诉我。
谢谢凯文
使用右侧表格上的 CSS position:fixed 属性,或在其周围使用
。
CSS 示例
#some-element {
position: fixed;
right: 0;
top: 0%;
}
引用
- http://www.w3.org/Style/Examples/007/menus.en.html(给你的完美榜样!
- http://www.w3.org/wiki/CSS_absolute_and_fixed_positioning
- http://davidwalsh.name/css-fixed-position
- http://caniuse.com/css-fixed
相关文章:
- 防止Iframe窗体在新窗口中打开
- Javascript更新孙窗口中的表单元素
- 如何通过所选索引(AngularJS)在模态弹出窗口中显示数据
- 重定向到父窗口中的链接
- 通过window.opener将弹出窗口中的值传递给父窗口
- 在窗口中添加滚动条
- 如何在模式弹出窗口中使用引导程序日期和时间选择器
- 按下一个HTML按钮,该按钮使用一个功能在同一个新窗口中打开URL
- 如何在Ol3弹出窗口中添加用javascript创建的按钮上的点击事件
- 更改不在引导模式窗口中工作的月份和年份
- 在窗口中单击按钮完成之前,光标不会停止.请继续卸载
- 如何隐藏谷歌地图Api 3中InfoBox窗口中的关闭(x)按钮
- 如何在新选项卡中而不是在新窗口中打开URL
- 窗口中的谷歌字体参差不齐
- 如何禁用鼠标中键单击超链接以在新选项卡或新窗口中打开
- chrome.tabs.create的回调不会在弹出窗口中触发
- 从父级触发弹出窗口中的事件
- 在传单标记弹出窗口中缓存Busting
- 在window.open()生成的窗口中执行JavaScript
- 为在新窗口中打开外部链接创建异常