SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DOM, <input type="file"

    var inputBrowse = document.getElementsByTagName('inputBrowse');

    alert(inputBrowse.value);


    inputBrowse is a input type file, now I need to get the value that's in it? But, value does not work?

  2. #2
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nevermind, it should be getElementById not getElementsByTagName
    bahhh

  3. #3
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Making up new tags is cool

  4. #4
    do righteous deeds
    Join Date
    Aug 2006
    Location
    Türkiye Turkey تركيى
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
      
    <script type="text/javascript">
    
    function getValue (){
    var el = document.getElementsByTagName("input")[0];
    
    alert(el.value);
    }
    </script>
    
    
    <input type="file" id="inputID" >
    
    <button onclick="getValue ()">get value</button>
    Code:
      
    <script type="text/javascript">
    
    function getValue (){
    var el = document.getElementById("inputID");
    alert(el.value);
    }
    </script>
    
    
    <input type="file" id="inputID" >
    
    <button onclick="getValue ()">get value</button>
    The Time Through Ages
    1. By the Time, 2. Verily Man is in loss, 3. Except such as have Faith, and do righteous deeds, and (join together) in the mutual enjoining of Truth, and of Patience and Constancy.


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
  •