Javascript 右表在XSL中始终在窗口中居中
我试图寻找这个答案,看到了一些问题,但无法解决我的问题 基本上,我们继承了一个XSL页面,该页面有两个HTML表,当您将鼠标悬停在主表上具有值“yes”的行上时,它会在右侧显示与该行相关的隐藏的第二个表,而如果“no”,则不会显示任何内容。但是,如果通过XSL显示大量结果,向下滚动时将无法看到该表 我只是想知道是否有一种方法可以在每次将鼠标悬停在value yes上时强制1右隐藏表保持在屏幕顶部,即使这意味着将XSL结果设置为具有滚动条 希望我已经说清楚了,请看我的代码摘录,我有麻烦Javascript 右表在XSL中始终在窗口中居中,javascript,html,xml,xslt,Javascript,Html,Xml,Xslt,我试图寻找这个答案,看到了一些问题,但无法解决我的问题 基本上,我们继承了一个XSL页面,该页面有两个HTML表,当您将鼠标悬停在主表上具有值“yes”的行上时,它会在右侧显示与该行相关的隐藏的第二个表,而如果“no”,则不会显示任何内容。但是,如果通过XSL显示大量结果,向下滚动时将无法看到该表 我只是想知道是否有一种方法可以在每次将鼠标悬停在value yes上时强制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>
函数showme(show)
{
document.getElementById(“”).style.display='none';
document.getElementById('summary').style.display='none';
document.getElementById(show.style.display='inline';
}
行动详情:160;返回
日期:
时间:
完成人:
百安居酒店;参考编号:
协会:
style.background='#f6f6f6',style.cursor='hand',document.getElementById('').style.display='inline'
style.background='#ffffff',document.getElementById('').style.display='none'
style.background='#f6f6f6',style.cursor='hand'
style.background='#ffffff'
-
对
不
协会:
-
如果你还需要什么,请告诉我
谢谢,
Kevin使用右边桌子上的CSS position:fixed属性,或者在其周围使用一个 CSS示例 工具书类
你能展示一个生成HTML的例子吗?上传一些截图会令人满意吗?该页面位于安全服务器上,包含我们无法泄露的数据。如果您仍然需要该页面,我想我可以尝试找到一个外部托管虚拟页面和数据的地方。让我知道。你用一种不太具体的形式重新组织这个问题怎么样。想一想问题的核心是什么,而不是什么是情境性的失误。您的问题是如何在HTML中实现某些东西(因此XSLT方面只是一个小问题)?或者你的问题是一个转型的问题?下面有更多的评论…如果问题真的是关于HTML的,那么创建一个非常简化的HTML页面,其中包含抽象的问题。在这种情况下,不要担心XSLT——这将在稍后出现。如果问题是转换性问题,那么再次抽象问题。提供一个简化的示例输入XML文档、预期的HTML输出、转换规则(如有必要,包括边缘案例),以及它是客户端XSLT还是服务器端XSLT。如果是服务器端,则指定XSLT版本和engine.Excellant!正是我想要的。还有很好的参考资料。谢谢你,肖恩!:)
#some-element {
position: fixed;
right: 0;
top: 0%;
}