开发者问题收集
我意识到我可能忽略了一些显而易见的东西,但到目前为止我似乎找不到它。我需要第二双眼睛。<!DOCTYPE html><html><head><script type="text/javascript">var t;t=document.getElementById('temperture');var v;v=document.getElementById('speed');var h;h=docu
在以下代码中:function Transact() {if(document.getElementById('itctobuy').value!='') {itctobuy = parseInt(document.getElementById('itctobuy').value);}if(document.getElementById('steamtobuy').value!='') {stea
此方法是模块的一部分;尽管有错误……未捕获的类型错误:无法读取 null(…) 的属性“1”在一定程度上有效,但似乎阻止了模块上的其他方法。这是一个包含整个模块的fiddle。searchURL: function() {function insertAfter(newNode, referenceNode) {referenceNode.parentNode.insertBefore(newNo
所以我一直在做一个游戏项目,如果玩家点击一个字母,并且该字母与短语相匹配,则它会显示该字母。如果玩家点击一个没有任何匹配项的字母(由 null 表示),则蓝色心形将变成丢失的心形,并且未命中计数器会增加。出于某种原因,即使玩家点击匹配的字母,我的代码仍然会显示丢失的心形。有人可以帮忙吗?这是整个项目的 github 链接:https://github.com/santanaquan/Techdeg
我有一个函数,它可以在 cookie 字符串中搜索特定的 cookie 并返回其值,但我不明白为什么当 cookie 存在时它一直返回 null。document.cookie = "userName=nameHere";function getCookie() {document.cookie.split(";").forEach(cookie => {if (cookie.substring(
我的 JavaScript 代码第 2 行出现“无法找到 null 的属性‘值’”错误。无论我是否在文本框中输入字符串,我都会收到此错误。有什么方法可以修复此问题?HTML:<!DOCTYPE html><html><head><title>Login Screen</title><link rel="stylesheet" type="text/css" href="login.css"/><s
我只是随便玩了一下,然后转到 CNN 文章并在控制台中运行了此代码。这个想法是能够单击p元素,它会将 DOM 节点替换为其中包含反向文本的节点。它按预期工作,但只能工作一次。当我尝试再次运行它以将其反转回来时,我在控制台中遇到错误,我不知道为什么:TaggedEventTracker.js:56 Uncaught TypeError: Cannot read property 'dataset'
我编写了一个显示日期的 JavaScript 代码。我该如何更改颜色?
因此,我有一些可以创建单独文本的 JavaScript。当我调用它时,为了生成输入文本,我会执行以下操作:<center><p id="w00t"><font color="white">text here</font></p></center><script type="text/javascript">new TypingText(document.getElementById("w00t")
我有一个 HTML 表格,显示的值如下:<table id="tableID"><thead><tr><th>Column heading 1</th><th>Column heading 2</th><th>Column heading 3</th><th>Column heading 4</th></tr></thead><tbody><tr><td> ID (43.1)</td><td>Cl
<script>function fun(){var a = document.getElementsByTagName("td");var a1 = a[0].innerHTML;var a2 = a[1].innerHTML;var a3 = a[2].innerHTML;var a4 = a[3].innerHTML;var a5 = a[4].innerHTML;var b;if ( a1
我正在尝试编写一个程序,使用一个函数通过数组和 for 循环更改预先写好的文本的颜色,具体取决于用户在提示时输入的内容。这是我的代码:// <Student Name> <Student ID> comment must be here.// This function will change the color of the text to the name of the color you g
function changeForeground() {var div = document.getElementById("foreground").className = "colorA";}function changeBackground() {var div = document.getElementById("background").className = "backgroundB
我正在使用单独的.js文件更改某些文本的颜色。我是 HTML 和 JavaScript 的新手,请详细说明。谢谢。这是我目前得到的结果:htmlfile.html<html><body><p id="demo"> Click the button to change the text in this paragraph. </p></body></html>jsfile.jsvar button
因此我希望用户可以选择要在显示区域上显示的文本颜色。这是我目前的代码:输入足够长的文本。$(function() {$(".fig_image").each(function() {var figSrc = $(this).data("image-src");$(this).css("background-image", "url('" + figSrc + "')");}).draggable(