Why won't my javascript code work in a HTML file? - javascript

Hi I am new to coding and trying to learn webb developpment. I were following and looking at a tutorial making a hamburger menu but cant get the javascript to work. Am I doing somthing wrong or have a forgot to download somthing in Visual studio code beacause i can't find any erors in the code.
HTML
CSS
CSS

Your spelling document wrong
var More = dokument.getElementById('More');
...
Javascript is annoying and will silently fail when an error happens. To view the errors hit f12 in your browser and go to the Console tab, they should show up in a big red banner :)

Related

Javascript alert pop up window isn't displaying except on embeded code and code written on Chrome browser developer console

If this question is inappropriate on this site, please tell me where I should ask this question.
alert("Hello World!");
I have ran this simple code on codepen JS editor and Chrome developer console for hundreds of times and it has worked. It also had no problems running as an embeded code on the tutorial website I was following.
However, for some reason I'm getting no response (i.e. no modal window popups) when I try to run the alert code above on Codepen and JSFiddle. However it works on js.do online javascript editor, Chrome developer console, and the tutorial website I've linked above.
Please note that I've tried using different browsers, changing site settings, and even restoring browser settings and clearing browser data.
I usually use Codepen while I'm learning JavaScript, so I want to know what's the problem.
It seems there can be a new browser restriction. If I try to add an alert to Codepen and look to the Chrome console I see this warning:
A different origin subframe tried to create a JavaScript dialog. This is no longer allowed and was blocked. See https://www.chromestatus.com/feature/5148698084376576 for more details.

How to add script tags to html

Here in the image you see the code is greyed out. Before I put in the <script> tag everything was not greyed out. Once I put in the tag is greys out the rest of the code. I might be missing a file needed to run the script tags?
I have been working with code for a while, but I am still a little stuck on how to get the code set up. I am wanting to use html/css and JavaScript to make a couple websites. I am not sure how to set everything up to make it work. I also am using github, and trying to figure out how to use github-pages.
A simple solution that works:
Just close the file being edited
Click "File->Reopen Last Item" to re-open it
This is an issue with Atom, it does not detect the tag when it auto completes, it works fine in VSCode, so it's not really a problem with your code, it's the IDE
enter image description here
As i recognize, the Atom text editor makes this error.
The best solution i tried:
IN ATOM TEXT EDITOR
Windows:
Ctrl + ,
MAC:
Cmd + ,
In settings:
1. Scroll to the bottom,
2. Uncheck "Use Tree Sitter Parsers",
3. Restart Atom IDE.
That works fine for me!
This is a known bug, but it seems no fix have been done yet, you can report your case here, I guess: HTML Syntax Colour Bug
But you may have solution in that StackOverflow subject, if so, it would be a duplicate: Atom Code Editor. Why is my code not in color?

Personal toolbar button in Forge Viewer not appearing

I followed the tutorial to learn Autodesk Forge. I linked my BIM 360 account to the Forge Viewer. I would now like to add extensions to it and have a button on the toolbar that links to my extensions.
However when I follow the extension tutorial, nothing shows up. I also tried this one https://forge.autodesk.com/en/docs/viewer/v5/tutorials/toolbar-button/#before-you-begin and nothing appear.
I do not know what I am doing wrong since it seems to work if we follow the tutorial...
I am working on VS code
Right now, my code looks like this in the index.html file :
enter image description here
The rest is exactly like the tutorial except that I replaced "MyAwesomeExtension" with "PieChartExtension"
One thing to try will be to switch your var config3d to the following:
var config3d = {extensions: ['PieChartExtension']}
The reason might be, your syntax might be affecting and that is why the Viewer does not understand what to load. Did you check the console for any messaging?

Is p5.js working on codepen?

I am testing my p5.js work on codepen but doesnt work.
Can you help why this doesn't work?
test page
The CodePen link in your comments works fine for me:
The link in your post looks like this:
...ah, I see now that there is a CodePen on that page that isn't loading. (You should really try to be more specific about exactly what you're seeing, this is why you're getting downvotes and confused comments.)
To debug that, you need to open the developer tools and look at the JavaScript console. You have a bunch of errors there that you need to fix.
Note that the CodePen you link in your page is different from the CodePen you've linked in the comments. The CodePen in the comments ends with GMZwyL, but the CodePen in your page ends with wrWJpg. If I go to that and look at the JavaScript console I see an error about not being able to load an image, and all I see is a blue screen.
You need to debug your program and make sure you look at all of the errors being generated.

Unknown javascript script scrolldown when enter page

I have problem with unknown javascript script which scrolldown when enter page (I think it's javascript). I trying to find over firebug, code, delete scripts, I even deleted all styles,scripts, and had a clean code.
When enter this page only in chrome browser its scroll down to comments div, I have no idea why only chrome, firefox it's not do this, I have tested 2 computers them both the same on chrome.
This is the link of the page:
http://test.ibids.co.il/add/120
Which script do it or what cause to do this?
EDIT 1 (27/01) : I don't think it's js as I have removed all JS from code.
EDIT 1 (27/01) : It wad addthis script problem.
Before you do anything else: check your imported scripts! You are importing jQuery three times! This might create unwanted side effects.
http://test.ibids.co.il/assets/js/new_js/jquery-1.9.1.js
http://test.ibids.co.il/assets/header-js/jquery-1.11.1.js
http://test.ibids.co.il/assets/notification/js/jquery-ab8e840c3dad7ccf2deadb8c40d53bdb.js
There might be more scripts / css that are not needed. Check your assets.
I cant comment so I will post answer. I have disabled all JS on site and still on reload page site was goes scroll down and then goes up so maybe it is not so JS related?
I think you have code related to navigate or nicescrollers in your script .First try to remove if you have any code related to navigateble :true ,and If you work on nicescrollers try to resize them or comment to check it once

Categories

Resources