我创建了一个显示成员列表的页面。我创建了一个Javascript函数,该代码在divpreview
position:absolute
z-index:100
和<div runat="server" id="divpreview" class="preview">
</div>
<script type="text/javascript" language="javascript">
function showdiv(id, m, pos) {
var arr = new Array(7);
arr = id.split("###");
var divhtml = "";
divhtml += "<table border='1' style='background-color:#1C5E55;color:white;absolute' cellpadding='3' cellspacing='0'><tr><td>Sponsor Id</td><td>" + arr[0] + "</td></tr>";
divhtml += "<tr><td>Total Left Point</td><td>" + arr[1] + "</td></tr>";
divhtml += "<tr><td>Total Right Point</td><td>" + arr[2] + "</td></tr>";
divhtml += "<tr><td>Total Left Investment</td><td>" + arr[3] + "</td></tr>";
divhtml += "<tr><td>Total Right Investment</td><td>" + arr[4] + "</td></tr>";
divhtml += "<tr><td>Self Point </td><td>" + arr[5] + "</td></tr>";
divhtml += "<tr><td>Expiry Date</td><td>" + arr[6] + "</td></tr>";
divhtml += "</table>";
document.getElementById("ctl00_ContentPlaceHolder1_divpreview").innerHTML = divhtml;
var left = m.clientX + 10;
if (pos == 1) {
left = m.clientX - 230;
}
else {
left = m.clientX + 10;
}
debugger;
document.getElementById("ctl00_ContentPlaceHolder1_divpreview").style.left = left.toString() + 'px';
document.getElementById("ctl00_ContentPlaceHolder1_divpreview").style.display = "block";
var top = 0;
top = document.documentElement.scrollTop + m.clientY - 50;
document.getElementById("ctl00_ContentPlaceHolder1_divpreview").style.top = top.toString() + 'px';
}
function hidediv() {
document.getElementById("ctl00_ContentPlaceHolder1_divpreview").style.display = "none";
}
function movediv(m, pos) {
var left = m.clientX + 05;
if (pos == 1) {
left = m.clientX - 200;
}
else {
left = m.clientX + 10;
}
document.getElementById("ctl00_ContentPlaceHolder1_divpreview").style.left = left.toString() + 'px';
var top = 0;
top = document.documentElement.scrollTop + m.clientY - 50;
document.getElementById("ctl00_ContentPlaceHolder1_divpreview").style.top = top.toString() + 'px';
}
</script>
的面板中显示了用户的详细信息,但是我无法在弹出/面板上方显示会员。
public void Connect(string host, int port, string user, string passPhrase, string privateKeyFilePath) {
var keyFiles = new[] { new PrivateKeyFile(privateKeyFilePath, passPhrase) };
var methods = new List<AuthenticationMethod>();
methods.Add(new PasswordAuthenticationMethod(user, passPhrase));
methods.Add(new PrivateKeyAuthenticationMethod(user, keyFiles));
var con = new ConnectionInfo(host, port, user, methods.ToArray());
var client = new SshClient(con);
client.Connect();
// create an xterm shell
var Shell = client.CreateShellStream("xterm", 80, 24, 800, 600, 1024);
// for reading & writing to the shell
var reader = new StreamReader(Shell);
var writer = new StreamWriter(Shell);
// ....
client.Disconnect();
}
我希望面板出现在星星附近。我该怎么办。
答案 0 :(得分:2)
使用
position: relative;
到父div。当找到最接近的位置相对或定位的绝对元素时,位置绝对元素将“停止”。
答案 1 :(得分:0)
在divpreview上使用此样式
<div runat="server" id="divpreview" class="preview" style="position:absolute;z-index:999;">
</div>
答案 2 :(得分:0)
position: absolute;
父div位置&#39;绝对&#39;。