SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Nov 2000
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hope any JavaScript programer can help me with this question, cuz I don't know anything about it.

    I have a simple computer quote script, I put example here:

    <script language=javascript>
    var called=false;
    var T_Price=0;
    var memory_flag;
    var cpu_flag;

    function compute(form){
    called=true;

    if (form.cpu[0].selected){cpu_flag= 0;cpu_print="None";}
    if (form.cpu[1].selected){cpu_flag= 69;cpu_print="AMD K6-2-500Mhz $69";}

    if (form.memory[0].selected){memory_flag=0;memory_print="None";}
    if (form.memory[1].selected){memory_flag=29;memory_print="32MB PC100 SDRAM $29";}
    T_Price=cpu_flag+memory_flag;

    </script>

    My question on the memory on the HTML section, I want to put a drop down quatity box in the memory section. How can I do that to trigger the calculate forum, please give me the details as I don't have any javascript programing knowledge, thanks a lot.

  2. #2
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Your drop-down will be a <select> tag of course. You can trigger the recalculation by adding onChange="compute(this.form)" to that tag.

    I hope that answers your question!
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •