|
Web design and Programming Discuss website creation and other programming topics. |
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
Dropdown bozes and calculating?
Heya,
i need a kickass direction to something i want to create ^^ I need 3 dropdown menu's next to eachother in which people can select an item and its bonus names.. Small explanation, in that game ( gladiatus ) we have items with an prefix and suffix, they are used to give a basic items its extra stats. What i want to do is to make it available online ( only working "script" i got is excel ) How should it look? : 3 dropdowns: |Prefix| ---- |Item| ---- |Suffix| List of stats -stat 1 -stat 2 -stat 3 -stat 4 -stat 5 -stat 6 When clicking on it you will be presented with a list of names and when you make your selection it will calculate the stats and show them to you underneath it. I got no idea on how to start off, so i need some general directions, or even better an example Since the different prefixes and suffixes make up different statistics it needs to calculate the items to given formula.. I hope i made it a bit clear on what i ment ^^ Site im planning to put it on is just a html / css site, nothing fancy there. *edit, yes i messed up the title, ment Boxes ^^
__________________
<- Sponsored by Chris Found on Youtube: Quote:
Last edited by katana*GFR*; 12-05-2010 at 11:47 AM. |
#2
|
||
|
Whats the formula? Some real live examples of the data and the end result would help alot. I'm sure this can be done with JavaScript..
__________________
04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#3
|
|||
|
I got an excel sheet which has the stuff in it, bu tmost formulas i got are in german ( which is most likely not your strongest foreign language ^^ )
i'll try to extract the formula again ^^ Been a while since we inserted it
__________________
<- Sponsored by Chris Found on Youtube: Quote:
|
#4
|
||
|
Visual Basic?
|
#6
|
||
|
VBS to Java compiler, Just adds scripts to visual fields automatically I hear.
|
#8
|
||
|
It would take me a long time to decipher that info
__________________
04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#9
|
|||
|
Could you point me to some javascript info with these sorts of info Scott?
As im pretty beat up on what to look for exactly, google isn't as good as it used to be in the old days.. And looking through a miliion pages and trying to weed out the advert links sucks
__________________
<- Sponsored by Chris Found on Youtube: Quote:
|
#10
|
||
|
Yeah searching for quality info now days usually ends up in blog spam.
It looks like drop down's with multi dimensional arrays would work. After the data is gathered from each drop box, the formula needs to be applied to all the drop down's values.
__________________
04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#11
|
||
|
I think I know what you're talking about. Simple javascript should do the trick. I'll try and write something basic you can use.
__________________
|
#12
|
||
|
You could do something like this in javascript:
Code:
function DropDown(targetName) { var dropDownInst = this; this.target = document.getElementById(targetName); if(targetname == null || this.target == null) return; // better to add some sort of exception handling here // Create prefix array this.prefixes = ["prefix1", "prefix2", "prefix3"]; // Create DOM select object var prefixSelect = document.createElement("select"); this.addOptions(prefixSelect, prefixes); // This is where we handle adding the item prefixSelect.onchange = function(e){ dropDownInst.addItem(this); }; } DropDown.prototype.addOptions = function(iSelect, iArray) { for(var i=0; i<iArray.length; i++) { var option = document.createElement("option"); option.value = iArray[i]; option.text = iArray[i]; iSelect.options.add(option); } } DropDown.prototype.addItem(iSelect) { var selectedValue = iSelect.options[iSelect.selectedIndex]; switch(selectedValue) { case "desiredPrefix1": // Add code here to create a new select and append it to the target break; case "desiredPrefix2": // Add code here to create a new select and append it to the target break; case "desiredPrefix3": // Add code here to create a new select and append it to the target break; default: alert("An invalid selection occurred!"); } }
__________________
|
#13
|
|||
|
bah, sounds like time to start a java course.. ^^
To bad i knew it wasn't going to be easy ^^ Cheers for the code so far Atholon. 1 thing, this piece only uses the given item + a prefix right? An would it be possible to read the Prefixes, Items and Suffixes from an .txt file or ini? Since that is the easy part to create, then the script stay's clean withotu cluttering it with all data.. If i count all prefixes, items and suffixes im nearing ( rough estimate ) 350 lines.. ( each item on 1 line with its + and - effects.. ^^
__________________
<- Sponsored by Chris Found on Youtube: Quote:
|
#14
|
||
|
Yeah the code I attached is not for the full thing, just an example. It basically is set to add a second dropdown box based on the selected values from the first dropdown.
If you want to load it from a text file you'd need a server-side language like PHP or ASP.net and use ajax calls. Javascript can't directly interface with files. You could use a java applet, silverlight or flash to do the drop downs and read from a text file as well. Think it's easier with JS though.
__________________
|
#15
|
||
|
It might be easier to use ajax actually, because you could load the first drop-down with the default values. Then you'd make an ajax call to your code behind language, it would then filter the results for you, then you can pass it back through an ajax response as an array. You create another drop down and load it with the results stored in the array. Then you do the same thing for a third box.
It just gets sort of messy when you are dealing with several cascading dropdowns, you might be able to find something easier by using that search term "cascading dropdowns". What programming languages do you use Katana? jQuery (a javascript library) makes it really easy to do ajax stuff.
__________________
|
#16
|
|||
|
Well atm only html ^^ I have been working on so many things that i never could catch up with anything more.. In all those years ^^
Might aswell make sure my excel file is updated with all details first and then try to start teaching myself some tricks. Been checking out some java builders, but thats a small step to high for me, so let alone that i start Ajax.. I did save all this info tho ^^. Any help is appreciated, and im willing to learn ^^ I still got my trustworthy DreamWeaver on my PC and that helps me out alot.. Im very visually minded, for html i do know my way by now, but that has taken me some time ^^ PS, msn is jigler@gladiatus.nl And i can be catched on IRC also alot.. irc.onlinegamesnet.net/6660 Channel: #jigler Just shout and i'll react asap ^^ on irc i got an bnc, and never change my name to reflect offline / online, so drop a query if you want to know for sure ^^
__________________
<- Sponsored by Chris Found on Youtube: Quote:
|
#17
|
||
|
I guess I should have asked this question: Does your web host support PHP or Asp.net or is it something else? I've done Ajax stuff with both PHP and Asp.net and could probably write you something in a week or two. I am at the end of the semester in school so I've got finals next week and will have little time until they're over.
If you've got the stuff in excel that is great, you'd just have to save a .csv file and you could read the stuff in very easily.
__________________
|
#18
|
|||
|
it supports that offcourse :P
Another thing Atho, where should i focus on as next step after html? I do have to start learning this stuff myself.. But im a bit "lost in the woods" And google has gone downhill the last few years, like Scott mentioned ^^ Any help is always welcome, but i don't want to make it so that you gys do the work and i just sit back and watch.. That is something i hate ^^
__________________
<- Sponsored by Chris Found on Youtube: Quote:
|
#19
|
||
|
I would focus on learning how to read a text file from PHP and using delimeters to break the text into usable data first.
__________________
|
#20
|
|||
|
o0 my post disappeared in the big mists of internet, or i just missed the submit button.. ^^
So i have dug myself a old copy of Lynda.com PHP Essential Training up.. Hello "Hello World" again ^^ Any further recommendations are welcome ^^
__________________
<- Sponsored by Chris Found on Youtube: Quote:
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
calculating ping times [HELP ME!!] | RuleXXL | Delta Force | 0 | 09-06-2008 02:36 PM |
calculating pimg times? | Mackem | Delta Force | 1 | 08-19-2006 10:14 AM |
100% CSS Dropdown Menus | Scott | Web design and Programming | 4 | 03-12-2005 12:37 AM |