These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

Need help with Javascipt/HTML code

Author
Mohingan Dark
Onyx Horizon Technologies
#1 - 2012-08-05 15:02:12 UTC
hey, im new to this stuff still (learning a little at a time)
What i want to know is if its possible to have a list of ships and have a price calculated for them (based on a addition script with manually inputed mineral prices)

basically i want the ship name with the price next to it in its own box or maybe just a different color text? idk

EXAMPLE
Tristan : 500,652 isk


here is my (farily pathetic) try to make it work -.-
LINK
Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#2 - 2012-08-05 16:23:18 UTC
It's doable.

You'll have to hardcode the mineral requirements though. With ME and production efficiency waste in them. (unless you code that up)

I know it's doable, as I'm doing it on my blueprint calculator (getting the details from the static data extract, and the prices from Eve-marketdata. Though that's using code on the server for some of the heavy lifting)

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Acid Kanshi
AIFAM
#3 - 2012-08-05 17:56:02 UTC
I do it with javascript in my calculator.

http://www.eve-cost.eu/calculator/index/12003

Basically you must have the ship material requirements. Add ME to it and multiply each material price with the amount you get after ME and add all the material sums together.

EVE-Cost is a manufacturing tool for EVE players. http://www.eve-cost.eu

Mohingan Dark
Onyx Horizon Technologies
#4 - 2012-08-05 18:11:57 UTC  |  Edited by: Mohingan Dark
ok, thanks for the fast responses

ive tried to make it work for one ship (tristan) but nothing shows up in the box even tho i have the script running onload.....do i need something other than "input type=text" or what am i missing?


thanks for the help (link to code is in the first post)
Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#5 - 2012-08-05 18:51:52 UTC  |  Edited by: Steve Ronuken
it's because all you're doing in your code is setting a javascript variable.

What you need to do is find the object representing that field in the DOM, and set the value of that.

http://www.mkyong.com/javascript/how-to-get-element-by-name-in-html-getelementsbyname/

Normally I'd use ID rather than name (it's unique. names don't have to be)

then something like
document.getElementById('h').value=h;


(and your Noxium multiplication is referencing a d. which doesn't exist. And you have nothing for the megacyte or zydrine a tristan uses.)


Firebug is handy for playing with the javascript to see what happens. And making the console easy to find, to see the errors.

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter