0
Why doesn't this code get executed?
var password= prompt("Enter the passcode to enter the page"); alert(password); When I execute this code I just dont revice any alert...what is the problem???
7 odpowiedzi
+ 1
There is no error in the code. Where did you put it?
+ 1
Did you include a script tag with a reference to your js file in your html? (This is not necessary if you are using Code Playground.)
<script type="text/javascript" src="my_external_file.js"></script>
+ 1
Yes, this is a script tag. Put this in your html. And of course, replace the name of the script in the src attribute with your script name. Then open the html page with your favorite browser, and the code should run.
Alternatively, you can use the javascript console of your browser (CTRL+SHIFT+K on Firefox). No need for an html file that way, but you then have to type all of your commands.
A probably better alternative would be to use Greasemonkey/Tampermonkey (for Firefox and Chrome respectively), and create userscripts. No need to have an html file, and you can set your favorite text editor (Notepad++ for example) to edit your scripts.
0
I used an external js code and in <head> tag I wrote <script type="text/javascript" src="scripts.js"></script>
And in addition to this code I have another alert in the scripts.js file and that alert executes...
0
Well this code is in notepad++ and I didnt understand you...<script type="text/javascript" src="scripts.js"> is a script tag isnt it?
0
My js file's name is scripts.js
0
was it in a function attribute