Posted: 10/17/2013 7:42:05 AM EDT
|
I want to use some JavaScript I found on the web. The script in question is found at http://arc.id.au/CannonBallistics.html. I would like to use both the "Muzzle Velocity” and "Ballistic Trajectory” code but have no idea how to accomplish this. The code was written by A. R. Collins , my first thought was to ask Mr. Collins for help but I have not been able to find an address for him (in my web search the only person that seems even remotely correct is the Dr. A. R. Collins who worked with Dr. Barns Wallace on the Dam Buster project!). I searched for the web address using "whois” but that came up negative. So, without being able to contact the author for help, can anyone "complete” the code and/or explain to me in bunny rabbit language how to make the code work? As requested by Mr Collins, I will credit him as the author if and when I print any results. I am pretty much programming illiterate, I did look at a few JavaScript tutorials on the web but they just made my head hurt. Thanks in advance. |
Are you trying to make a web page to use this on? If you go that route, you're 95% of the way there with the code that was given.// Barrel bore for standard iron shot weights, windage of 25/24 is assumed <input type="text" id="ball_mass" />User inputs values in those 2 text boxes and clicks calculate. You just need to provide the function to retrieve the input values, pass them to the MuzzleVelocity function then write the result out. If you want, I can make an html page that would do all that. Just let me know. |
|
Yes, I think I want to "activate" (?) that code on a web page; I thought that was the only way to use it? I'm assuming it can be done so that I can simply open IE or Mozilla and access the code from my hard drive; I am not looking to post it on the web. I also would like to add one more variable at the beginning of the code: bore [3] = 2.83. Thanks |
This should work, but it's not too pretty. I'm also assuming you'll probably just load the html file on your local machine rather than hosting it somewhere so I didn't include anything like jquery.<html> |
|
Open Notepad.exe (if on Windows) Copy code and paste into Notepad. Click File then Save As... Change the "Save as type" dropdown to "All Files" instead of "Text Documents" Put in a file name like "muzzlecalc.html" and select a location to save the file. Once it's saved, you can just double click it and it will open in your internet browser.
|
|
Sessrumnir First I have to say sorry for not getting back sooner; higher priorities took over. I followed your directions and I now get the input screen but nothing happens when I input the numbers. I'm not smart enough to work the math behind the formulas to see if it is correct or not; I will try to find someone who is smarter than I. Thanks for the help; if I get it running I'll let you know. |