我的脚本标签发生了什么.为什么它显示红色(错误) [英] what happen with my Script tag .why it is showing red color(error)

查看:290
本文介绍了我的脚本标签发生了什么.为什么它显示红色(错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[![] [2]] [2]

[![][2]][2]

请参阅脚本标签..为什么脚本标签和脚本标签下的元素显示红色(错误),当我尝试在onClick方法上调用此函数时,表明此函数未定义

See Script Tag ..why Script tag and element under Script tag showing red color(error) and when I try to call this function on onClick method it's showing that this function is not defined

推荐答案

如果该图像是您当前的情况,那么您的函数将不再命名为toggle(),而是命名为toggleControls().

If that image is your current situation, then your function is no longer named toggle() but toggleControls().

对于您的脚本标签,您在开始标签的右括号之前留了一个空格:<script >.
我不确定,但是将其更改为<script>可能会成功.

As for your script tag, you left a space before the closing bracket of the opening tag: <script >.
I'm not sure, but changing it to <script> might do the trick.

作为旁注,在
<img src="../MovieLandingPage/images/close.png" class="close"onclick="toggle();>
您缺少onclick属性的右引号.
而且您应该真正养成用空格分隔属性的习惯,这更具可读性.

As a side note, in
<img src="../MovieLandingPage/images/close.png" class="close"onclick="toggle();>
you're missing a closing quotation mark for the onclick attribute.
And you should really make a habit of separating your attributes by spaces, it's a lot more readable.

这篇关于我的脚本标签发生了什么.为什么它显示红色(错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆