Original Code Not Executing After Removing Javascript in Eclipse - javascript

I tried inserting some javascript into a jsp file on Eclipse. I added a scripts folder to the WebContent folder and added a helloWorld.js file and then added a script tag and did some input validation, which failed to work.
After removing all this failed javascript validation my original code no longer runs. I get a 500 error just trying to submit a parameter on the request. The parameter is null when I enter a number on the form. Any idea why? This is Eclipse.
I have deleted the javascript, the javascript file, and the scripts folder.
Yours Truly
(As Humanly Possible)
Cnight62

Related

How to modify Javascript return value by selenium

I'm doing automatic test by python selenium.A problem has been encountered that requires changing the value of a parameter in the JS file before the script can jump to the next page.Is there any way to modify the parameter values in the JS file of the current page through Python Selenium.When I test it manually, I'll break it in the front-end JS file before clicking the button, assigning a value to that variable in the JS file, and making the system think I've already seen the video file.

code syntax auto interpret into html entity code

I run a php file on my server, it was fine when i edited the code locally. After I uploaded it to the server, some symbols were converted to HTML Entity Code.
Why would this happen?
I'm using Insert_PHP plugin, and the code is running within a page inside Wordpress. I created a few pages, only this is having syntax interpretation issues.

Jade: How to include js file in a certain point

i want to include a file that must be used only when a jade file is render client side, this is the .jade file:
button(type="button")#start.flex
p#timer.flex
button(type="button" )#stop.flex
script(src='../public/js/timer.js')
The js file will handle the timer function, i have a console log in the .js file but it is never fired. What i'm doing wrong? I canno't import it in the head because the element won't be ready yet.
Thus i have to find a way to include and use timer.js only when this file is render. Thank you guys
JavaScript inserted as DOM text will not execute.
You must load the script file initially, with the document load. When loading content via AJAX response, execute whatever javascript function or functions you want in the success handler. There are other ways as well, but your current design wont work.
Checkout this link:
http://caih.org/open-source-software/modularjs/loading-javascript-script-vs-ajax-vs-both/

changes to javascript file "ignored" in VS2010

I have a javascript file harSympCode.js that I am trying to make changes to. It is used in 5 aspx pages - .NET 4.0 & VS2010 - and needs to remain consistent for all 5.
In the js file there is a function startstop() which triggers a floating clock to count. It is called in the onload event of the body tag. It works just fine. There is another function (call it function1()) which is supposed to load some values to a form. It is almost identical to a second one (call it function2()) in the file except the second one does a form.submit() when it is done. I am attempting to modify function1() to also submit the form when done BUT no matter what I do, I can not get the system (VS2010 localhost) to recognize the 2 lines of code I added. Since they are working just fine in function2() and I don't see any error codes or warnings when I rebuild the website, I can only guess that the changes are being ignored.
What I have tried:
Removed the <script> tag from the aspx pages: Result - startstop(), function1() and function2() are not found.
Added the <script> tag back in but removed the script file from the solution/project directory structure: Result - everything runs as if the file was still there.
Deleted sln and suo files and reopened the website while at the same time trying options 1 and 2: Results - same as 1 and 2.
I have looked through my entire directory structure and renamed and/or deleted every version of the js file I could find, to no avail.
I have looked for anything and everything related to precompiling a website (NOT application) and attempted to make changes to a supposed "Precompile" directory but a) could not find the directory and b) all changes I made were ignored and/or reset the next time I went and looked.
Has Anybody seen this and how did you fix it?
This does not seem like an IDE issue as mentioned in your comment. Make sure you set your browser to refresh the cache on each load. In IE:
If you're using Chrome, then cache is cleared from the dev tools and is very persistent. Also refresh the page using CTRL+F5. You also want to make sure that you're not getting compilation errors and your project isn't running from the previous working version. However point 1 of what you've tried suggests that the generated HTML page refreshes when you run your project but your browser cache contains the javascript files and so when the script tag exists it finds the cached ones and executes them. So you can use the 2nd button from the top (Clear Browser Cache...) to remove them.
I had been having this issue, clearing my cache and wondering why VS2010 kept looking at the old file, even though it appeared as the new version in F12.
The solution turned out to be that TFS had the file locked, and that once I checked out the javascript in question, the debugger picked up the new version.

Including .inc javascript file in ASP doesn't work, only .js does

New to ASP and probably never named a Javascript file ".inc" :-)
But that seems to be the norm where I'm currently working.
I observed that right on the first page I started getting these javascript errors
Message: 'globalVariableXXX' is undefined
I found that the javascript file wasn't getting called at all.
Just changed the name to ".js" and it worked !!
The ASP file includes the JavaScript file like this :
<SCRIPT LANGUAGE="Javascript" SRC="include/MenuCode.inc"></SCRIPT>
But there are 100's of these ".inc" files and 100's of references to them, hence don't want to go with this solution.
I'd rather understand it..
Any idea why it would've worked in the first place and why it isn't now ?
I'm sure I'm missing something pretty basic in ASP..
Another point : This application is installed on another server and it works just fine there when I hit it. I'm trying to install it on this new box.
Where I made the change for it to work:
In IIS, Right click on the name of the machine and the Mime Types are right over there. Checked the old server and it had the settings for ".inc", copied them and it started working :) Thanks all.
Maybe someone changed the webserver to prevent it serving .inc files ?
In the management console (inetmgr) right click the website and choose Properties. Go to "home directory" tab and click Configuration.
You will probably see the .inc extension there (in the mapping tab) meaning those files are parsed by the ASP engine.
Remove the item from the mappings table, apply and you should be able to parse those files as raw data.
The proper way to use a script tag for javascript is with the type attribute, such as
<script type="text/javascript" src="include/MenuCode.inc"></script>
see: http://www.w3schools.com/tags/tag_script.asp
language isn't even listed as a supported attribute by the standard..
Edit: The reason .js worked and .inc didn't is .js is in the mime type definitions of the server as a JAVASCRIPT mime type by default. If not using an extension configured as text/javascript by default, you have to tell the browser what to treat the file as somehow. This is why the text attribute of script is a required attribute as per html 4.01.

Categories

Resources