如何修复“无法读取null的属性'样式'”-Javascript中的错误?

时间:2019-08-21 16:27:59

标签: javascript

尝试使其变为“ Taso 1”(第1阶段)时,它将在主菜单上显示第2阶段。尝试使用样式不透明和显示,但始终返回错误

Cannot read property 'style' of null at column 4

第4列:

var jepulis = document.getElementById("je").style.opacity = "0.0";

这是我试图通过阶段1显示的我的阶段2超链接

<a href="Taso2.html"  id="je">Taso 2</a><br>  

进入第1阶段时,它将激活joo()

function joo(){ 
jepulis.style.opacity = "1";
}

很抱歉,如果解释混乱,如果某些部分不清楚,请随时提出问题。

3 个答案:

答案 0 :(得分:0)

您的问题是

v2 <- na.omit(v1)
stack(setNames(as.person(v2)$email, v2))[2:1]
#                               ind                 values
#1 Persons Name <personsemail@email.com> personsemail@email.com
#2          person 2 <person2@email.com>      person2@email.com
#3    Random Name <randomname@email.com>   randomname@email.com

您现在想做的是 document.getElementById(“ je”)。style.opacity =“ 0.0” .style.opacity =“ 1”; 并不能像解决您的问题那样

func = scipy.interpolate.interp2d(x,y,yy)

arr = func(new_xx,new_yy)

现在您的功能joo可以工作了

答案 1 :(得分:0)

在此处具有完整的代码将很有帮助,但是使用Chrome / Firefox开发人员控制台/工具将帮助您学习并找出问题所在。您可以逐行运行函数,看看问题出在哪里。就您而言,它看起来像:

R1=K+sqrt(K.^2-1); R2=K-sqrt(K.^2-1); if abs(R1)<1 r=R1; else r=R2; end

是您想要的,然后在函数调用中设置不透明度,但是很难准确分辨。在Mac上按real imaginer -0.7536 0.0512 -0.802 0.0426 -0.8496 0.0408 -0.8872 0.0327 -0.927 0.0338 -0.9575 0.0242 -0.979 0.0174 -0.9977 0.0113 -10,031 0.0029 -10,012 -0.007 -0.9876 -0.0167 -0.9654 -0.0249 -0.9299 -0.0401 -0.8797 -0.0488 -0.8176 -0.0623 -0.7297 -0.0782 -0.6458 -0.0865 -0.5351 -0.1051 -0.4098 -0.1197 -0.2701 -0.1349 -0.1177 -0.1489 0.0536 -0.1699 0.213 -0.1853 0.3933 -0.1921 0.5519 -0.1857 0.7128 -0.1896 0.8511 -0.1712 0.9468 -0.1452 10,222 -0.0943 10,375 -0.04 10,134 0.0365 0.9361 0.1255 0.8122 0.2168 0.6622 0.3108 0.4657 0.3774 0.2577 0.4497 0.0431 0.4775 -0.1463 0.5093 -0.3442 0.4999 -0.5203 0.4782 -0.6692 0.4417 -0.7781 0.3822 -0.8856 0.3293 -0.9703 0.2615 -10,187 0.193 -10,524 0.1254 -10,614 0.0557 -10,539 -0.0016 -10,297 -0.0698 -0.9879 -0.1212 -0.9355 -0.1829 -0.8721 -0.2298 -0.8011 -0.2783 -0.7232 -0.325 -0.6401 -0.3586 -0.5455 -0.4008 -0.4429 -0.43 -0.3524 -0.4433 -0.2455 -0.4769 -0.1336 -0.4863 -0.0391 -0.5073 0.0779 -0.5105 0.1776 -0.5196 0.2869 -0.5152 0.3893 -0.5084 0.4831 -0.4978 0.5888 -0.4907 0.6822 -0.4574 0.7614 -0.4381 0.8484 -0.4017 0.9098 -0.3585 0.9771 -0.3172 10,268 -0.2607 10,667 -0.2102 10,969 -0.1464 11,115 -0.0724 11,141 -0.0019 10,981 0.0838 10,645 0.1546 10,135 0.2457 0.9409 0.3332 0.8657 0.4061 0.7519 0.4973 0.6426 0.5635 0.5072 0.6302 0.3633 0.6782 0.2148 0.7161 0.0382 0.7573 -0.1051 0.7395 -0.273 0.7359 -0.4273 0.7154 -0.5653 0.6794 -0.6971 0.6279 -0.8202 0.555 -0.905 0.493 -0.9996 0.4155 -10,716 0.3239 -11,006 0.2549 -11,444 0.1479 -11,464 0.0722 -11,493 -0.0031 -11,282 -0.0814 -11,040 -0.1603 -10,645 -0.2219 -10,187 -0.2787 -0.9514 -0.3223 -0.8878 -0.3841 -0.8225 -0.42 -0.7415 -0.4606 -0.6607 -0.4889 -0.5577 -0.5319 -0.482 -0.5512 -0.3775 -0.5614 -0.2918 -0.5798 -0.1621 -0.5712 -0.0979 -0.5917 0.0149 -0.5559 0.1062 -0.5734 0.2142 -0.5648 0.3159 -0.5363 0.3844 -0.5302 0.5019 -0.5066 0.5805 -0.4709 0.6626 -0.4506 0.7482 -0.4117 0.8005 -0.363 0.8799 -0.3378 0.9349 -0.2889 0.9883 -0.2449 10,306 -0.1946 10,643 -0.1373 10,870 -0.1025 10,935 -0.0389 10,840 0.0184 10,732 0.0639 10,333 0.1274 0.9906 0.1739 0.9243 0.2293 0.8455 0.2752 0.7527 0.3035 0.6292 0.3394 0.5384 0.3524 0.3808 0.3845 0.2509 0.4067 0.0931 0.4004 -0.0423 0.3839 -0.2123 0.377 -0.3666 0.3537 -0.4838 0.3309 -0.6157 0.288 -0.7211 0.2604 -0.8322 0.2172 -0.8947 0.1791 -0.9618 0.1366 -10,024 0.0932 -10,299 0.0493 -10,415 0.0099 -10,333 -0.0243 -10,092 -0.0612 -0.9798 -0.0906 -0.9321 -0.1302 -0.8796 -0.1472 -0.8121 -0.17 -0.7414 -0.1886 -0.6649 -0.2019 -0.5907 -0.2149 -0.4793 -0.2271 -0.4011 -0.2224 -0.3121 -0.2408 -0.1948 -0.2343 -0.0997 -0.2322 0.008 -0.2328 0.1304 -0.2224 0.2662 -0.2213 0.4093 -0.2298 0.553 -0.2406 0.7094 -0.3018 0.8613 -0.383 0.9745 -0.5634 0.9796 -0.8226 0.7781 -0.9412 0.6424 -0.8495 0.6264 -0.8147 0.6071 -0.6706 0.6682 -0.6029 0.6759 -0.5596 0.71 -0.5218 0.7479 -0.4825 0.7691 -0.4476 0.8264 -0.4056 0.8412 -0.3912 0.8511 -0.3813 0.8689 -0.3425 0.899 -0.3375 0.8827 -0.3198 0.9024 -0.3164 0.929 -0.2876 0.9106 -0.2855 0.9695 -0.2079 10,342 -0.5353 0.8692 -0.5046 ,或在var jepulis = document.getElementById("je");上按一下,您可以在其中逐行粘贴函数中的正文以诊断发生了什么。希望有帮助。

答案 2 :(得分:0)

不要将“”设置为不透明,它是一个整数值,而不是字符串

<a href="Taso2.html"   id="je">Taso 2</a>

var elem = document.getElementById('je');
  elem.style.color = 'red';
  elem.style.opacity=1;