//<文本域收到回车后提交内容:
<textarea id="ta_caption" onkeyup = "captionInput(event);"></textarea>
// 字幕"文本域"输入时接收到回车键就提交内容给后台
function captionInput(event){
var curkey = event.which;
if(curkey == 13){
var caption = $("#ta_caption").val();
// 提交给媒体预览Servlet
$.ajax({
type : 'POST',
url : "MediaPreviewServlet",
data : {'capContent':caption},
error : function(){
$("#ta_caption").focus();
},
success : function(){
//$("#ta_caption").val("");//清空内容
},
datatype : 'json'});
// 字幕预览没有勾选时,发给底层xml进行缓存
$.ajax({
type : 'POST',
url : "UpdateXmlServlet",
data : {'capContent':caption},
datatype : 'json'});
}
}
<textarea id="ta_caption" onkeyup = "captionInput(event);"></textarea>
// 字幕"文本域"输入时接收到回车键就提交内容给后台
function captionInput(event){
var curkey = event.which;
if(curkey == 13){
var caption = $("#ta_caption").val();
// 提交给媒体预览Servlet
$.ajax({
type : 'POST',
url : "MediaPreviewServlet",
data : {'capContent':caption},
error : function(){
$("#ta_caption").focus();
},
success : function(){
//$("#ta_caption").val("");//清空内容
},
datatype : 'json'});
// 字幕预览没有勾选时,发给底层xml进行缓存
$.ajax({
type : 'POST',
url : "UpdateXmlServlet",
data : {'capContent':caption},
datatype : 'json'});
}
}