我使用Vanilla Masonry(原始JS,非jQuery版本)如下:
在头部:
<script id="masonry" type="text/javascript" src="resources/js/masonry.js"></script>
Run Code Online (Sandbox Code Playgroud)
身体:
<script>
window.onload = function() {
var wall = new Masonry( document.getElementById('ext-component-3'), {
columnWidth: 145
});
};
</script>
Run Code Online (Sandbox Code Playgroud)
但我一直在:
Uncaught ReferenceError: Masonry is not defined
Uncaught TypeError: Cannot call method 'appendChild' of undefined
Run Code Online (Sandbox Code Playgroud)
有谁知道我的设置有什么问题?
我正在尝试将一个带有JQuery滑块插件的Wordpress网站放在一起,但该插件没有显示在页面上,我总是得到上面的错误消息.
尽管在其他帖子中尝试了几种不同的修复方法,我仍然无法解决上述错误,包括将脚本标记放在"header.php"文件中.任何帮助将不胜感激 - 谢谢!
'footer.php'文件中的相关代码
<!--Load JQuery-->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
网站:http://www.advanceprojects.com.au/
在Javascript中定义类时,如何从另一个方法中调用一个方法?
exports.myClass = function () {
this.init = function() {
myInternalMethod();
}
this.myInternalMethod = function() {
//Do something
}
}
Run Code Online (Sandbox Code Playgroud)
上面的代码在执行时给出了以下错误:
ReferenceError:未定义myInternalMethod
我也尝试过this.myInternalMethod和self.myInternalMethod,但都会导致错误.这样做的正确方法是什么?
我正在尝试使用 javascript 获取数字的平方根。
为此,我尝试了以下代码:
<script>
var rad = sqrt(4);
alert(rad);
</script>Run Code Online (Sandbox Code Playgroud)
(这会在 Firefox 的控制台中返回“ReferenceError:sqrt 未定义”)
<script>
var rad = pow(4,0.5);
alert(rad);
</script>Run Code Online (Sandbox Code Playgroud)
(但我得到“ReferenceError:pow未定义”)
我究竟做错了什么?
因此,我使用纯CSS创建了一个iPhone,并试图通过单击更改屏幕以使其具有交互性。我是Java脚本的新手,大约一周前才开始学习它,浏览器告诉我“ Uncaught ReferenceError:未定义url”,不确定我在做什么。关于为什么它告诉我的任何建议,因此请确保将来不要犯同样的错误。我确信这是一个简单的修复程序,只是不确定如何去做。
<div id="iphone-border">
<div id="off-button"></div>
<div id="mute-button"></div>
<div id="volume-up-button"></div>
<div id="volume-down-button"></div>
<div id="side-lines-1"></div>
<div id="side-lines-2"></div>
<div id="iphone-color">
<div id="camara"></div>
<div id="sensor"></div>
<div id="speaker"></div>
<div id="iphone-screen" onClick="this.style.backgroundImage=url(img/phone-screen.jpg);" >
</div>
<div id="home-button-border">
<div id="home-button-color"></div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud) 我已经尝试过其他Stackoverflow主题的所有解决方案,但我不能使用我的jQuery文件.我使用Wampserver来测试我的代码,并在多个浏览器(Firefox,Chrome,Opera)内部进行测试.每次都有同样的问题.
HTML
<script src="js/scripts.js"></script> <script src="js/jquery-3.2.1.min.js"></script>
我把这些行放在结束<\ body>标记之前
scripts.js`
(function($) {
'use strict';
// holds current image shown
var $currNr = 0;
var links, images;
/**
* Function to prevent closures; adds click event handler to links
*/
var addEvents = function(nr) {
// add click event to link
$(links[nr]).on('click', function(e) {
showImage(nr);
e.preventDefault();
});
};
/**
* Function to show an image
*/
var showImage = function(nr) {
// find image
var $img = $(images[nr]);
if (!$img) return;
// …Run Code Online (Sandbox Code Playgroud)
nicole@MacBook-Air client % mongosh
Current Mongosh Log ID: 6167b26073f2085eee4554b6
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000
Using MongoDB: 5.0.3
Using Mongosh: 1.1.0
For mongosh info see: https://docs.mongodb.com/mongodb-shell/
------
The server generated these startup warnings when booting:
2021-10-13T15:36:00.307-07:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
------
test> show dbs
admin 41 kB
config 111 kB
local 41 kB
test 8.19 kB
test> use test
already on db test
test> show collections
users
test> test.users.find() …Run Code Online (Sandbox Code Playgroud) 我有一个html文件,其中,我想编辑字段.以下是我的HTML代码:
<body>
<div class= "table">
<div class = "thead">
<div class = "tr">
<div class = "td">ID</div>
<div class = "td">GROUP NAME</div>
<div class = "td">GROUP DESCRIPTION</div>
<div class = "td">IS ACTIVE</div>
<div class = "td"></div>
<div class = "td"></div>
</div>
</div>
<div class= "tbody">
<form class = "tr">
<div class = "td">1</div>
<div class = "td">hello</div>
<div class = "td">hwryou</div>
<div class = "td">y</div>
<div class = "td action" ><button type="button "onclick="edit(this);">edit</button> </div>
<form>
</div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
以下是我的javascript代码:
<script …Run Code Online (Sandbox Code Playgroud) 考虑以下代码:
//the var Test has NOT been declared yet
console.log((typeof Test)); // "undefined"
console.log(Test); //"Uncaught ReferenceError: Test is not defined"
Run Code Online (Sandbox Code Playgroud)
为什么第二个console.log语句抛出一个ReferenceError,第一个显示未定义.
我正在使用c ++在Qt中编写一个程序.但是由于这个错误,我在这一点上陷入困境.奇怪的是,我创建了一个单独的程序,其中下面的代码工作,但当我把代码放在我的程序中时,我得到一个错误.
error: undefined reference to `vtable for Create_button_config'
Run Code Online (Sandbox Code Playgroud)
错误发生在我创建类的Header文件中.这是发生错误的头文件的一部分.
class Create_button_config : public QObject
{
Q_OBJECT
public:
QMap<QString, QString> buttons;
void setParameters(){
qDebug() << "test";
buttons["ID1"] = "#52B1";
buttons["ID2"] = "#52B2";
buttons["ID3"] = "#52B3";
}
};
Run Code Online (Sandbox Code Playgroud)
我在main.cpp中使用它就像这样
Create_button_config config;
config.setParameters();
Run Code Online (Sandbox Code Playgroud)
这个错误来自何处?顺便说一句,这是一个正确的方法来创建一个在我的整个代码中可用的关联数组?
提前致谢
我已经开始通过各种视频教程学习 node.js。
下面的代码不起作用,输出应该是'false'firstconsole.log()和'true'second console.log()。
这是我在 app.js 中的代码:
console.log('Starting app');
console.log(_.isString(true));
console.log(_.isString('Saurabh'));
Run Code Online (Sandbox Code Playgroud)
输出
在 CMD 中:
saurabh@kumar:/var/www/html/notes-node$ nodejs app.js
Starting app
/var/www/html/notes-node/app.js:25
**console.log(_.isString(true));**
^
**ReferenceError: _ is not defined**
at Object.<anonymous> (/var/www/html/notes-node/app.js:25:13)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3
saurabh@kumar:/var/www/html/notes-node$ npm -v
3.5.2
Run Code Online (Sandbox Code Playgroud) 你能解释一下为什么下面的代码给我一个错误(仅限严格模式)?
'use strict';
name = 'Adam';
console.log(name);
doSomething = function() {};Run Code Online (Sandbox Code Playgroud)
安慰:
亚当
参考错误:doSomething 未定义
我有以下问题:我想printHello从函数调用函数testHello。该printHello函数可以独立工作,但是,当我尝试printHello从该testHello函数调用时,出现引用错误。谢谢您的帮助。
class Test {
constructor(name) {
this.name;
}
printHello(parameter) {
console.log(parameter);
}
testHello() {
printHello(printHello(this.name));
}
}
var test = new Test("Sandro");
test.printHello("hello"); //works, prints "Hello" to the Console
test.testHello(); // does not work: Reference Error: printHello is not definedRun Code Online (Sandbox Code Playgroud)