38 users online (2 members and 36 guests)  


  Results 1 to 12 of 12

Related

  1. help moving linked images    Forum: Myspace Forum
    Replies: 1
  2. drag layer with linked images in!?    Forum: HTML Forum
    Replies: 0
  3. Replies: 2
  4. Autoreloading a linked page    Forum: HTML Forum
    Replies: 4
  1. #1
    Dr_fish's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2003
    Posts
    9

    price boxes linked with menu

    alright all, ok heres my site: http://www.eng.nene.ac.uk/~bf02jafo/index.html i need price boxes to be linked to a product i select from my drop down menu any ideas? thanks in advance

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hi,

    What have you tried so far?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    Dr_fish's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2003
    Posts
    9
    not much to tell the truth i cant think of any way of doing it!

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    fair enough

    To start with, I think we need a better definition of what we need here. What exactly do you want these price boxes to do? just show the price? add up the price? etc
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  5. #5
    Dr_fish's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2003
    Posts
    9
    haha well mate i need the price boxes to fill in with the appropriate price relating to the selected object, at the end i will need a sub-total any ideas?

  6. #6
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hmm. Best bet would be javascript, I think.

    Do you have any experience of javascript? you can use it to set and add up form fields quite easily.

    Here is a very simple example,

    HTML Code:
    <script language="JavaScript">
    function add_up() {
    obj=document.testform;
    proc=eval(obj.processor.value);
    gfxc=eval(obj.gfxcard.value);
    
    
    obj.total.value=proc + gfxc;
    }
    </script>
    <form name="testform">
    <input type="button" value="AMD2000+" onClick="this.form.processor.value='400'; add_up();">
    <input type="text" size="6" name="processor" value=0><br />
    <input type="button" value="GeForce 4MX" onClick="this.form.gfxcard.value='180'; add_up();">
    <input type="text" size="6" name="gfxcard" value=0><br />
    <input type="text" size="6" name="total" readonly value=0> <-- TOTAL
    </form>
    Try adapting this to your needs. any questions about the code, post away.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  7. #7
    Dr_fish's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2003
    Posts
    9
    where you've used button can i use my menu?

  8. #8
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Yes, you can. You have to access the value of the <select> box differently than other inputs tho.

    in effect, the value is

    Code:
    document.formname.inputname.options[document.formname.inputname.selectedIndex].value;
    to actually see it at work, have a look at the code used in our dropdown menu maker
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  9. #9
    Dr_fish's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2003
    Posts
    9
    could you take a line from my source code and show me? if you cant thats ok so far youve helped alot its just i need to get this done for tomrrow

  10. #10
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Heres an example using one of the dropdowns from your page -

    HTML Code:
    <script language="JavaScript">
    function add_up() {
    obj=document.testform;
    proc=eval(obj.processor.value);
    gfxc=eval(obj.gfxcard.value);
    
    
    obj.total.value=proc + gfxc;
    }
    </script>
    <form name="testform">
    
    <select name="example" size="1" onChange="this.form.processor.value=this.form.example.options[this.form.example.selectedIndex].value;add_up();">
    <option value="1000">Athlon</option>
    <option value="1390">Pentium 4</option>
    <option value="1900">Athlon64</option>
    <option value="20">celeron</option>
    </select>
    <input type="text" size="6" name="processor" value=0><br />
    <input type="button" value="GeForce 4MX" onClick="this.form.gfxcard.value='180'; add_up();">
    <input type="text" size="6" name="gfxcard" value=0><br />
    <input type="text" size="6" name="total" readonly value=0> <-- TOTAL
    </form>
    I will leave you with that to figure the rest, Its my bed-time good luck.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  11. #11
    Dr_fish's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2003
    Posts
    9
    you are the man! youve saved my life cheers a bunch mate.

  12. #12
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Glad its sorted.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread