如何使 Javascript 输入文本看起来像 HTML?样式表未应用于 Javascript,但适用于 HTML。
<html>
<head>
<link rel="stylesheet" href="lib/BlackBerry-JQM-all.css" />
<script src="lib/BlackBerry-JQM-all.js"></script>
</head>
<body onLoad="onPageLoad()">
<div data-role="content" id=content></div><!-- /content -->
<input type=text id=tPlay2 placeholder=Play_HTML>
<script type="text/javascript">
function setContent(id, msg)
{
var ele = document.getElementById(id);
if (ele) {
ele.innerHTML = msg;
}
}
function onPageLoad()
{
var sPlay;
sPlay = '<input type=text id=tPlay1 placeholder=Play_JS>';
setContent("content", sPlay);
}
</script>
</body>