如何解决为什么即使删除并保存该代码也仍会在我的代码中显示?
此特定代码行不断出现在此文件const { clean } = require("underscore");
中,它是该文件的顶部。我什至删除并保存了它,以后还会再来。在链接到该文件的其他文件中也可以。我与此行相关的唯一一件事是一个名为clean.js的文件,该文件只是删除我的文本,按钮和内容的功能。
function clear() {
$('.texts').remove();
$('.buttons').remove();
$('.lines').remove();
$('.brs').remove();
$('.e-buttons').remove();
$('.centers').remove();
};
有人知道为什么会这样吗?也许与Jquery数据库有关?
const { clean } = require("underscore");
var Dif = '';
function download(filename,text) {
var pom = document.createElement('a');
pom.setAttribute('href','data:text/plain;charset=utf-8,' + encodeURIComponent(text));
pom.setAttribute('download',filename);
pom.click();
};
function Systems(core) {
if (core == 'Main_Menu') {
clear();
$("<p class='texts' >This is a main menu,please pick New Game,Save Game,Load Game,or Options.</p>").insertBefore("#placeholder");
}
else if (core == 'Save') {
download ('Files/Address.txt','You are ' + gender + ',by the name of ' + pn + ',and you claim to be a ' + OBG + '.');
//add a way for player to change Files/Address.txt into what they want by use input,then attach that to variable and then use that variable to replace the name of file in download format above this comment.
console.log("save complete successful!");
}
else if (core == 'Option') {
clear();
$('<center class=\'centers\'><button class=\'command_button d-buttons\' value=\'difficulty\'>Difficulty</button></center><br class=\'brs\'>').insertBefore('#placeholder_choice');
}
};
$(document).on('click','.d-buttons',function() {
var button = $(this).val();
console.log('The Button is ' + button);
$('#console').scrollTop($('#console')[0].scrollHeight);
if (button == 'difficulty') {
clear();
$('<center class=\'centers\'><button class=\'command_button d-buttons\' value=\'easy\'>Easy</button></center><br class=\'brs\'>').insertBefore('#placeholder_choice');
$('<center class=\'centers\'><button class=\'command_button d-buttons\' value=\'normal\'>Normal</button></center><br class=\'brs\'>').insertBefore('#placeholder_choice');
$('<center class=\'centers\'><button class=\'command_button d-buttons\' value=\'hard\'>Hard</button></center><br class=\'brs\'>').insertBefore('#placeholder_choice');
}
else if (button == 'easy') {
clean();
point = 800;
Dif = 'easy';
console.log("The difficulty is on " + Dif + ". You have " + point + " of points now.");
$('<p class=\'texts\'>You are now playing on easy mode.</p>').insertBefore('#placeholder');
}
else if (button == 'normal') {
clean();
point = 400;
Dif = 'normal';
console.log("The difficulty is on " + Dif + ". You have " + point + " of points now.");
$('<p class=\'texts\'>You are now playing on normal mode.</p>').insertBefore('#placeholder');
}
else if (button == 'hard') {
clean();
point = 200;
Dif = 'hard';
console.log("The difficulty is on " + Dif + ". You have " + point + " of points now.");
$('<p class=\'texts\'>You are now playing on hard mode.</p>').insertBefore('#placeholder');
}
});
// $('<p class=\'texts\'></p>').insertBefore('#placeholder');
// $('<center class=\'centers\'><button class=\'command_button buttons\' value=\' \'></button></center><br class=\'brs\'>').insertBefore('#placeholder_choice');
// $('<input type=\'text\' class=\'command_line lines\' size=\'50\' autofocus=\'autofocus\' autocomplete=\'off\'></input>').insertBefore('#placeholder').fadeIn(0);
//$('<button class=\'command_button e-buttons\' value=\'pistol\'>Pistol</button>').insertBefore('#placeholder_choice');
解决方法
您在某些地方拥有clear
函数,而在其他地方则具有clean
。
根据您使用的IDE /编辑器及其配置方式,如果您实际上未在任何地方声明clean
函数,我感觉它会自动导入第一个{{1 }}功能,它可以在您的目录中找到。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。