+ Reply to Thread
Results 1 to 4 of 4

Thread: Asking help for a simple application

  1. #1
    zyreena is offline x10Hosting Member zyreena is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    57

    Asking help for a simple application

    is there anyone who tried creating a simple application that uses JavaScript to dynamically update the contents of a text field with the value selected by a drop down (select) menu?

    i am new to java scripting too, and got a hard time understanding EVERYTHING im reading. and based on experience its way better for me to understand easily if i am going to analyze the syntax/code of a certain application.

    a help will be very much appreciated. tnx in advance
    beginner always starts from the scratch
    www.alliancetutorial.x10hosting.com

  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Asking help for a simple application

    More a DOM matter than JS:
    HTML Code:
    <form>
    <input name="someText" />
    <select onchange="setText(this, 'someText')">
    <option value="foo">Foo</option>
    <option value="bar">Bar</option>
    </select>
    </form>
    <script type="text/javascript">
    function setText(from, toName) {
      from.form[toName].value = from.value;
    }
    </script>

  3. #3
    OdieusG is offline x10Hosting Member OdieusG is an unknown quantity at this point
    Join Date
    Jan 2009
    Location
    Bangor, Maine
    Posts
    50

    Re: Asking help for a simple application

    Easiest way is store values in an array, and just like Mission put, use the onChange and IDs to signify what information it should change to
    Here's a small example, by principle. I'm not too adept in javascript, but this should give a general idea, it only displays an alertbox, but from that, you should be able to figure something:
    Code:
    <script type="text/javascript">
    var arr = new Array("Item 1", "Item 2", "Item 3");
    function popup() {
    	var x=document.getElementById("pulldown").value;
    	alert(arr[x]);
    }
    </script>
    <form>
    <select id="pulldown" onChange="popup()">
    <option value="0">Alpha</option>
    <option value="1">Beta</option>
    <option value="2">Gamma</option>
    </select>
    </form>

  4. #4
    zyreena is offline x10Hosting Member zyreena is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    57

    Re: Asking help for a simple application

    you two are of really great help. tnx for being so kind. im starting to analyze both codes. GOD BLESS
    beginner always starts from the scratch
    www.alliancetutorial.x10hosting.com

+ Reply to Thread

Similar Threads

  1. Simple problem: Where to upload??
    By tiedup in forum Free Hosting
    Replies: 3
    Last Post: 12-20-2008, 12:09 PM
  2. Simple JS exercises - answers needed asap!!!
    By goldy300 in forum Programming Help
    Replies: 3
    Last Post: 11-19-2008, 09:34 AM
  3. Two very simple php file upload scripts-Free
    By Symbian.Ankit in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 02-20-2008, 09:55 AM
  4. Simple Forum Sig Tutorial (Photoshop)
    By Veivei in forum Graphics & Webdesign
    Replies: 7
    Last Post: 09-05-2007, 09:34 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers