html>
<html>
<head>
<meta charset="utf-8">
<title>title>
<script>
function app(){
var inputs=document.getElementsByTagName("input");
var str=inputs[0].value;
var str1=inputs[1].value;
var str2=inputs[2].value;
if((str.length>0)&&(str1.length>0)&&(str2.length>0)){
var nT=te.insertRow();
var Td0=nT.insertCell();
var Td1=nT.insertCell();
var Td2=nT.insertCell();
var Td3=nT.insertCell();
Td0.innerHTML=input[0].value;
Td1.innerHTML=input[1].value;
Td2.innerHTML=input[2].value;
Td3.innerHTML="";
}
else{
alert("请把信息填写完整");
return;
}
}
function db(r){
var i=r.parentNode.parentNode.rowIndex;
document.getElementById("te").deleteRow(i);
}
script>
head>
<body>
<p align="center" id="info">
姓名:<input type="text" id="username"/>
Email:<input type="text" id="email"/>
年龄:<input type="text" id="age"/>
p>
<div align="center">
<input type="button" value="添加" onclick="app()"/>
div>
<hr>
<table align="center" border="1" id="te" style="width: 60%;text-align: center;border: 1px solid red;">
<tr>
<td>姓名td>
<td>Emailtd>
<td>年龄td>
<td>操作td>
tr>
table>
body>
html>
把内容打印出来看看,或者设置一个高度
"<span style='white-space: nowrap;text-overflow:ellipsis; overflow:hidden; display: inline-block;width:100%;'>"+$$$+"</span>"
第二步:其他修改
$('.reportPane')[0].style.background = "#1e243c";
var trs = $('.x-table tr');
trs.each(function(i, e) {
if (i % 2 == 0) {
e.style.backgroundColor = "#3e495b";
} else {
e.style.backgroundColor = "#353e4f";
}
});
//var currentcell = contentPane.curLGP.currentTDCell;
//if (currentcell != undefined) {
//var currow = $('.x-table tr')[contentPane.curLGP.getTDRow(currentcell)];
//currow.style.backgroundColor = "#2f4b69";
//currow.style.borderStyle = "solid";
//currow.style.borderWidth = "3px";
//currow.style.borderColor = "#3881c6 #1e4570 #1e4570 #3881c6";
//};
//鼠标经过
$(".x-table tr").mousemove(function() {
$(this).css("background-color", "#2f4b69");
$(this).css("border-style", "solid");
$(this).css("border-width", "3px");
$(this).css("border-color", "#3881c6 #1e4570 #1e4570 #3881c6");
});
//鼠标点击
$(".x-table tr").mousedown(function() {
$(this).css("background-color", "#2f4b69");
$(this).css("border-style", "solid");
$(this).css("border-width", "3px");
$(this).css("border-color", "#3881c6 #1e4570 #1e4570 #3881c6");
});
//鼠标离开
$(".x-table tr").mouseout(function() {
var i = $(this).context.rowIndex;
$(this).css("border", "none");
if (i % 2 == 0) {
$(this).css("background-color", "#3e495b");
} else {
$(this).css("background-color", "#353e4f");
}
});