SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Evangelist borna's Avatar
    Join Date
    Jun 2006
    Location
    Iran, Tehran
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up IMPORTANT: get value

    How will you get the value of an Text Box?
    Codes like <input type=text name="crossCode" value="javascript:getValue();" size=3>

    or

    <input type=text name="crossCode" value="" size=3>

    does not retrive well results.
    Think of getValue of an input. i.e, we need the value of an object after it has been given value. or we need to use a script like document.form1["xxxx"].value in the value of above inputs which is not functioning.

  2. #2
    SitePoint Zealot
    Join Date
    Aug 2005
    Posts
    153
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to use JavaScript of course, like this for example:

    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <
    HTML>
    <
    HEAD>
    <
    META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <
    TITLE>Example</TITLE>

    <
    SCRIPT TYPE="text/javascript">

            function 
    GetValue() {

                     
    alert("The Value of the box is " document.Test.TheBox.value);

            }


    </SCRIPT>

    </HEAD>
    <BODY bgcolor="#FFFFFF" text="#000000">

    <DIV style="position:absolute;left:0px;top:0px;width:250px;height:80px;z-index:4" align="left">
    <FORM name="Test">
    <DIV style="position:absolute;left:4px;top:20px;width:81px;height:16px;z-index:0" align="left">
    <FONT style="font-size:13px" color="#000000" face="Verdana">Enter Text:</FONT></DIV>
    <INPUT type="text" style="position:absolute;left:88px;top:18px;width:144px;z-index:1" size="18" name="TheBox" value="">
    <BUTTON onClick="GetValue()" type="button" style="position:absolute;left:70px;top:46px;width:83px;height:24px;z-

    index:2"><P><FONT style="font-size:13px" color="#000000" face="Verdana">Get Value</FONT></P></BUTTON>

    </FORM>
    </DIV>
    </BODY>
    </HTML> 


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
  •