JS Universal apps "无法获取property 'style'未定义或空引用的
JS Universal apps "Unable to get property 'style' of undefined or null reference"
我正在尝试使用Javascript项目在MS Universal应用程序中设置旋转
但是我收到以下错误信息
>0x800a138f - JavaScript运行时错误:无法获取未定义或空引用的属性"style"
我已经在整个web中查看了几个错误报告,我看到的大部分是元素首先必须创建,但在我的情况下,它是,因为函数只有在我设置表单中的值时才执行我也试过setAttribute,但它给出了相同的消息只有setAttribute
HTML
<section>
<p>Set rotation Value!</p>
<input id="rotationInput" type="text" />
<button id="setRotation">Set Rotation</button>
</section>
...
<section>
<img class="rotateimg" src="images/logo.scale-100.png" />
</section>
default.js
args.setPromise(WinJS.UI.processAll().then(function completed() {
...
// Retrieve the button and register event handler.
var setRotation = document.getElementById("setRotation");
setRotation.addEventListener("click", buttonClickHandler2, false);
};
...
function buttonClickHandler2(el) {
var degrees = document.getElementById("rotationInput").value;
document.getElementById("rotateimg").style.transform = "rotate(" + degrees + "deg)";
id和class不一样,看
<img class="rotateimg" src="images/logo.scale-100.png" />
应该<img id="rotateimg" src="images/logo.scale-100.png" />
,或者
<img id="rotateimg" class="rotateimg" src="images/logo.scale-100.png" />
相关文章:
- 为什么“;未定义的“;在JavaScript中结束循环
- 要求未定义JS回调参数
- 如何检查管道中未定义的项目
- TypeError:无法读取属性'推'未定义的JavaScript
- $window.ga在AngularJS事件中未定义
- 未捕获的TypeError无法读取未定义的属性socialsharing
- 为什么grunt contrib connect的中间件选项的第三个参数是未定义的
- 滚动字幕未捕获类型错误:无法读取属性'style'的未定义
- document.getElementsByTagName:无法读取未定义的属性“style”
- 未捕获的类型错误:无法读取属性'style'未定义的:document.getElementsByNam
- React的子组件有未定义的props.style
- Javascript运行时错误:无法获取property 'style'动态创建的文本框的未定义引用或空
- 未捕获的TypeError: Cannot read property 'style'未定义的HTML
- 规则.style在处理document.styleSheets时未定义
- JS Universal apps "无法获取property 'style'未定义或空引用的
- 为什么style.display'的值未定义?
- 使用数据表按两列排序(不能读取property ' style '未定义)
- getElementsByClassName.style 是未定义的
- 无法获取property 'style'在ie11中未定义或空引用
- 0x800a138f - JavaScript运行时错误:无法获取属性'style'未定义或空引用的