[英]I can't get numbers to show up in jsfiddle
http://jsfiddle.net/HKhw8/67/ http://jsfiddle.net/HKhw8/67/
HTML: HTML:
<p>You can see this text... <span id="text"></span></p>
<p>...but not this: <span id="mathStuffs"></span></p>
<p>Number variables don't seem to show, either- <span id="num"></span></p>
JavaScript: JavaScript的:
var text = 'Hello'
var i = 50;
document.getElementById('text').innerHTML = text;
document.getElementById('mathStuffs').innerHTML = math.pow(5,2);
document.getElementById('number').innerHTML = i;
The code doesn't show up in the preview like some of the nicely color-coded syntax highlighting like I've seen in previous posts- sorry about that. 代码没有像我在以前的帖子中看到的那样以彩色编码的语法突出显示在预览中,对此感到抱歉。
I originally thought that console.log() was the problem, so I have this example set up. 我本来以为console.log()是问题所在,所以我设置了这个示例。 Regular text variables show up, but I can't seem to get the numbers or functions that return numbers to appear.
常规文本变量出现了,但是我似乎无法获得数字或返回数字的函数出现。 Is there something I'm doing wrong?
我做错了什么吗? I've tried fiddling with the No wrap - in setting, but I can't understand.
我尝试摆弄No wrap-in设置,但我听不懂。 I've tried Chrome and FF.
我已经尝试过Chrome和FF。
math
is not a class of javascript it should be Math
math
不是javascript类,应该是Math
document.getElementById('mathStuffs').innerHTML = Math.pow(5,2);
Also one of the reference of a div is wrong 也是div的引用之一是错误的
document.getElementById('number').innerHTML = i;
it should be num
它应该是
num
document.getElementById('num').innerHTML = i;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.