www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] parsing values using js and passing into a text field

  1. #1
    Join Date
    Jun 2008
    Posts
    33

    resolved [RESOLVED] parsing values using js and passing into a text field

    I am trying to parse the URL values and pass into a text field.
    i was able to parse it but i couldn't dump that value into a text field..
    can anyone suggest.
    Here's what i did:

    <script type="text/javascript">
    function test(){
    var url = window.location.href;
    var sub = url.split('=:')[1];
    document.write(sub);
    document.getElementById('clksrc').value = sub;
    }
    </script>
    <input name="clksrc" id="clksrc" value="document.write(sub)" type="text" />

    so first part gets the value from URL after '=' and dumps it in variable 'sub'. but how do i pass that into a text field?

  2. #2
    Join Date
    Oct 2006
    Posts
    939
    HTML Code:
    <script type="text/javascript">
    function test(){
    var url = window.location.href;
    if(url.indexOf('=:')!=-1){
    var sub = url.substring(url.indexOf('=:')+2,url.length);}
    document.getElementById('abc').innerHTML=sub;
    document.getElementById('clksrc').value = sub;
    }
    </script>
    
    <BODY onload="test()">
    <div id="abc">_</div>
    <input name="clksrc" id="clksrc" value="document.write(sub)"  />

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
  •  
HTML5 Development Center



Recent Articles