SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to get value from ID

    i saw a code where they don't mention input field name and other things how we can get value of input from ID attribute in they are using jquery i think
    here is example code


    PHP Code:
    <table class="tab-form">
                        <
    tbody id="ztable">

                            <
    tr class="scnd" id="row1">
                                <
    td class="td-num" style="width: 25px;">1</td>
                                <
    td class="td-pin">
                                    <
    input type="text" class="inp pin" maxlength="4" /> - <input type="text" class="inp pin" maxlength="4" /> - <input type="text" class="inp pin" maxlength="4" /> - <input type="text" class="inp pin last_pin" maxlength="4" />

                                </
    td>
                                <
    td class="td-hint">
                                    <
    img src="/images/ico-quest.gif" width="18" height="18" alt="" class="show_help_btn cursor_p" />
                                </
    td>
                                <
    td class="td-pasw" style="width: 173px;">
                                    <
    img src="/images/but-pasw_en.gif" width="152" height="20" alt="" class="show_pass_btn cursor_p" />
                                    <
    div class="pass_box"><span id="pass_first"></span><input type="password" class="inp_pass" /></div>
                                </
    td>
                                <
    td class="td-online">

                                    <
    input type="checkbox" class="mobile_chk mobile_psc" />
                                    <
    img src="/images/ico-quest.gif" width="18" height="18" alt="" class="show_online_btn cursor_p" />
                                </
    td>
                                <
    td class="td-val td-center" style="width: 80px;">
                                    <
    select class="psc_val" onchange="calc_summ();">
                                        <
    option value="EUR" selected="selected">EUR</option>
                                        <
    option value="CHF">CHF</option>
                                        <
    option value="GBP">GBP</option>

                                        <
    option value="RON">RON</option>
                                        <
    option value="CZK">CZK</option>
                                        <
    option value="NOK">NOK</option>
                                    </
    select>
                                    <
    img src="/images/ico-quest.gif" width="18" height="18" alt="" class="cursor_p show_hint_btn2" />
                                    <
    input type="hidden" class="currency" />
                                </
    td>

                                <
    td class="td-nomin">
                                    <
    input type="text" class="inp summ nominal" value="0" onblur="nom_blur(this);" onfocus="nom_focus(this);" /><input type="hidden" class="rate" /><input type="hidden" class="cvalue" />
                                </
    td>
                                <
    td class="td-del">&nbsp;</td>
                            </
    tr>

                        </
    tbody>
                    </
    table

  2. #2
    Non-Member Kalon's Avatar
    Join Date
    Aug 2010
    Location
    At my computer
    Posts
    2,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    which element do you want the value of?

  3. #3
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    off all input fields

  4. #4
    Non-Member Kalon's Avatar
    Join Date
    Aug 2010
    Location
    At my computer
    Posts
    2,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, if they didn't use element names or id's they probably used the document.forms.elements array to get the input values

  5. #5
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    they are using id on TR how i can get value using tr class of each input field separetly

  6. #6
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anybody can explain using which id i can get values in my action script

  7. #7
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is the actual website link
    http://www.paysafecard2paypal.com/paysafecard_en.html
    there action is going in CGI Bin but how can i get the values in php
    using the same condition

  8. #8
    Non-Member Kalon's Avatar
    Join Date
    Aug 2010
    Location
    At my computer
    Posts
    2,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by realcoder View Post
    they are using id on TR how i can get value using tr class of each input field separetly
    you can use

    Code:
     
    function getElementsByClassName(oElm, strTagName, strClassName) {
        var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
        var arrReturnElements = new Array();
        strClassName = strClassName.replace(/\-/g, "\\-");
        var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
        var oElement;
        for(var i=0; i<arrElements.length; i++) {
            oElement = arrElements[i];
            if(oRegExp.test(oElement.className)){
                arrReturnElements.push(oElement);
            }
        }
        return (arrReturnElements)
    }
    to get an array of all the elements with a given class.

    then you can loop through that array and get all the input elements and output their current values.


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
  •