Javascript 如何在a<;tr>;?
这是我的密码Javascript 如何在a<;tr>;?,javascript,jquery,Javascript,Jquery,这是我的密码 <tr style="display: none"><td colspan="5"> <div id="sub-155642" style="display:none;"> <table width="100%"> <tr> <td class="inner-table"></td>
<tr style="display: none"><td colspan="5">
<div id="sub-155642" style="display:none;">
<table width="100%">
<tr>
<td class="inner-table"></td>
<td class="inner-table">Document No</td>
<td class="inner-table">Document Type</td>
<td class="inner-table" id="amount-row">Total Amount</td>
</tr>
</table>
</div >
</td>
</tr>
文件编号
文件类型
总金额
我想从JavaScript或jQuery中弹出内部
的内容。您可以将表克隆到某个弹出窗口并显示它:
HTML
<table>
<tr id="sub-155642" style="display: none">
<td colspan="5">
<div id="sub-155642" style="display:none;">
<table width="100%">
<tr>
<td class="inner-table"></td>
<td class="inner-table">Document No</td>
<td class="inner-table">Document Type</td>
<td class="inner-table" id="amount-row">Total Amount</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<button onclick="popup()">Pop-up</button>
JSBin:
否则,可以使包装表可见(但请确保ID是唯一的):
JavaScript
var popupEl;
function popup() {
var divEl,
tableEl,
xEl;
if(!popupEl) {
// Find table
tableEl = document.querySelector('#sub-155642 > table');
divEl = tableEl.parentNode;
// Create popup and clone table to it
popupEl = document.createElement('div');
popupEl.innerHTML = divEl.innerHTML;
popupEl.setAttribute('style', 'position:fixed;top:50%;left:50%;width:300px;height:100px;margin-left:-150px;margin-top:-50px;border:1px solid gray');
// Show popup
document.querySelector('body').appendChild(popupEl);
} else {
document.querySelector('body').removeChild(popupEl);
popupEl = null;
}
}
var div = document.getElementById('sub-155642');
div.style.display = 'block';
div.parentNode.parentNode.style.display = 'table-row';
你说的弹出窗口到底是什么意思?写得很糟糕。Html元素id在整个页面上必须是唯一的,但这里的“tr”和“div”具有相同的iddiv@cubaguest这是一个只有一行的主表