JS文本解析器不起作用
JS Text Parser Not Working
我想做一个文本解析器,我做了很多研究。
我想知道我是否正确使用了javascript。我知道你不应该真的用js制作文本解析器,但它是我知道的唯一脚本语言。
这是我到目前为止的代码:
<script>
function makeCode() {
for (i = 0; i < userCode.length; i++) {
if (userCode.substring("print:"(0, 6)) {
document.write(usercode.substring("print:"(6,0));
}
</script>
<style>
p {
text-align: center;
color: #cc0000;
}
h1 {
text-align: center;
font-family: Impact;
color: #cc0000;
}
body {
text-align: center;
}
form {
text-align: center;
}
</style>
<h1>NCPL</h1>
<p style="font-size: 10px">In Browser NinjaCorp Programming Language Editor</p>
</head>
<body>
<form name="userCode">
<textarea id="userCode" name="userCode" cols="80" rows="20" placeholder="Type your code here"></textarea></br>
<a href="javascript:makeCode()"><button type="button">Run Code!</button></a>
</form>
这是你要找的吗?
function makeBode() {
var userCode = document.getElementById('userCode').value;
var myDiv = document.getElementById('myDiv');
// alert(userCode)
for (i = 0; i < userCode.length; i++) {
myDiv.innerHTML = myDiv.innerHTML + userCode.substring((i,i+6)) +'<br>';
}
}
p {
text-align: center;
color: #cc0000;
}
h1 {
text-align: center;
font-family: Impact;
color: #cc0000;
}
body {
text-align: center;
}
form {
text-align: center;
}
<div id="myDiv"></div>
<h1>NCPL</h1>
<p style="font-size: 10px">In Browser NinjaCorp Programming Language Editor</p>
</head>
<body>
<form name="userCode">
<textarea id="userCode" name="userCode" cols="80" rows="20" placeholder="Type your code here">Typing here so there is some text to work with </textarea></br>
<a href="javascript:makeBode();"><button type="button">Run Code!</button></a>
</form>
相关文章:
- d3js文本传输-示例代码不起作用
- Javascript文本框验证不起作用
- I'我试图在文本区域中进行特定的输入,调用特定的javascript函数,但没有成功;不起作用
- mouseover和mouseleave文本颜色更改在指令链接中不起作用
- javascript文本验证不起作用.警报消息没有't显示
- 在SVG中创建带有外来对象的文本区域的Javascript不起作用
- html/jquery输入类型:单选框中的文本不起作用
- jQuery在文本输入点击时不起作用
- 如果文本框为空,则不起作用
- 对照数组脚本检查文本框中的值不起作用
- 为什么不'使用此JavaScript将文本替换为不起作用的链接
- Angular Js 尝试从主按钮回调动态更改模态文本并且不起作用
- 文本长度限制在我的 instafeed 模板中不起作用
- CKEditor - 插入文本在 setData 之后不起作用
- 动态文本大小JavaScript在IE中不起作用
- 文本颜色的随机色调不起作用
- Fabric.js文本转换不起作用
- 为什么这个使用谷歌URL的Javascript文本到语音不起作用
- Accordion文本效果在使用JavaScript的简单html页面中不起作用
- :包含不区分大小写的解决方案在替换文本以突出显示时不起作用