HTML:
<table class="table_database_edit">
<tr><td>Magazyn wycieraczek</td><td>Edytuj</td><td>Usu?</td></tr>
<tr class="more" id=""><td colspan="3">aa</td></tr>
<tr><td>test</td><td>Edytuj</td><td>Usu?</td></tr>
<tr class="more" id=""><td colspan="3">aa</td></tr>
</table>
Run Code Online (Sandbox Code Playgroud)
CSS:
tr.more{
#display: none;
}
table.table_database_edit{
width: 100%;
border-collapse:collapse;
border-spacing: 0;
}
table.table_database_edit tr:nth-child(4n+3), table.table_database_edit tr:nth-child(4n+4){
background-color: #EFF0F1;
}
table.table_database_edit tr:hover:nth-child(n) + tr:nth-child(n):after{
background-color: #FFFFCC;
}
table.table_database_edit tr:hover:nth-child(n+1) + tr:nth-child(n+1):before{
background-color: #FFFFCC;
}
Run Code Online (Sandbox Code Playgroud)
我有桌子.每两行都是一组.这些组交替背景颜色.第1行和第2行是白色的.第3行和第4行是灰色的.第5行和第6行是白色的.等等.
当您将鼠标悬停在某个组上时,我想将背景颜色设置为黄色.我怎么能这样做?
我写在线网页编辑器,我想在服务器上保存当前视图/工作,以便将来恢复.我也想做多个标签.
我知道,那是editor.getSession()和editor.setSession().
JS:
var editor = ace.edit("description");
editor.session.setMode("ace/mode/javascript");
editor.setTheme("ace/theme/tomorrow");
editor.setShowPrintMargin(false);
editor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: true
});
Run Code Online (Sandbox Code Playgroud)
现在我尝试通过jQuery将session保存$.data()到元素:
$('#tab1').data('sesi',editor.getSession()); //save session
editor.setSession($('#tab2').data('sesi')); //restore other session
Run Code Online (Sandbox Code Playgroud)
但是这段代码不起作用.当我尝试时,console.log(editor.session);我在控制台中看到了很多代码.
我尝试session通过POST数据发送到服务器,但在网络控制台中,我只看到来自编辑器的代码,仅此而已......
$.ajax({
type: "POST",
url: "aaaaa.php",
cache: false,
timeout: 10000,
data: "session="+ editor.session
});
Run Code Online (Sandbox Code Playgroud)
如何将会话保存到变量或服务器?