我有一个网页,其中包含一个JavaScript函数,可将多行转换为逗号分隔的数据。这是代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Add case</title>
<script type="text/javascript">
function replaceSeperator() {
var incident_box = document.getElementById("TextBoxIncidentID")
var content = incident_box.value;
//incident_box.innerHTML = content.replace(/\n/g, ",");
var ctt = content.replace(/\n/g, ",");
var lastchar = ctt.substr(ctt.length - 1);
if (lastchar != ",") {
incident_box.innerHTML = ctt;
} else {
incident_box.innerHTML = ctt.substr(0,ctt.length - 1);
}
}
</script>
</head>
<body>
<textarea name="TextBoxIncidentID" rows="2" cols="20" id="TextBoxIncidentID" textwrapping="Wrap" acceptreturn="true" onmouseout="replaceSeperator()" style="font-family:Calibri;font-size:Medium;height:60px;width:430px;margin-top: 5px;"></textarea>
</body>
</html>
它在IE中工作正常: The line break replaced to comma
但它在Chrome和Firefox中无法正常运行: Line break replaced to comma at Dev Tool but it doesn't present on Chrome
有人知道如何解决它吗? 感谢
答案 0 :(得分:0)
使用nameOfImageView.setImageViewDrawabλε(getDrawble(R.drawble.nameOfPicture));
属性。 value
用于其他目的。甚至textarea都有结束标记,内部内容是textarea值:
innerHTML
答案 1 :(得分:-1)
您在
末尾缺少f
;
有些浏览器比其他浏览器更宽容。