The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 5 of 5

Thread: Using Javascript to fill variable, display image.

  1. #1

    Using Javascript to fill variable, display image.

    I have a text input box that I want to enter a word into and then click submit.
    Upon clicking submit, the word that was entered into the box will add itself into the following string:

    PHP Code:
    http://ichart.finance.yahoo.com/z?s=HERE IS THE VARIABLE&t=1y&q=l&l=on&z=m&p=e20,e50,e200&a=v,m26-12-9,r14,ss 
    This will then be used to display the image on the page.

    Ideas?

  2. #2
    176
    posts
    Registered User
    HTML Code:
    <script language="javascript">
    function appendString(obj){
      var v=document.getElementById('textfield').value;
      obj.action='http://ichart.finance.yahoo.com/z?s=' + v + '&amp;t=1y&amp;q=l&amp;l=on&amp;z=m&amp;p=e20,e50,e200&amp;a=v,m26-12-9,r14,ss'
      return v==''?false:true;
    }
    </script>
    ...
    
    <form action='' onsubmit="appendString(this)" method="post">
    <input type="text" name="textfield" id="textfield" />
    <input type="submit" value="submit" />
    </form>
    PHP Code:
    <zip> echo this; </zip

  3. #3
    Looks logical enough, what would i use to actually display the image from the submission?

    Added file for code continuity.

    Thanks.
    Attached Files Attached Files
    Last edited by darley; February 10th, 2006 at 05:30 PM. Reason: Added File

  4. #4
    176
    posts
    Registered User
    ...
    Last edited by antizip; February 10th, 2006 at 06:43 PM.
    PHP Code:
    <zip> echo this; </zip

  5. #5
    So at least you see what I am trying to do.
    Just trying to get a quicker way to view the images.

    If I type the direct URL in the Firefox address bar, I can just switch out the stock symbol and it will display the image.

    But, yeah, when trying to use a form i am having nothing but trouble.

    This code you just posted makes sense, but, if i read correctly, you are saying that it cannot go and grab the images?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012