HTML 'input type=submit' question

Discussion in 'OT Technology' started by crotchfruit, Nov 5, 2003.

  1. crotchfruit

    crotchfruit Guest

    so i have a submit button in an html form, and it's inside of a table. for example:


    <table width=300>
    <tr>
    <td width=100%>
    <input type=submit name="yay" value="yay">
    </td>
    </tr>
    </table>


    so here's the deal: i want it so that the submit button spans the entire 300 width of the table/td, not just big enough for the text inside. is this possible (aside from padding the button text with spaces)?
     
  2. Rob

    Rob OT Supporter

    Joined:
    Jul 6, 2002
    Messages:
    88,612
    Likes Received:
    36
    Location:
    Atlanta, GA
  3. crotchfruit

    crotchfruit Guest

    i reread my post. i apologize for not being more clear.

    i'm really looking for something that will make the button scale to the size of the table element it is embedded in. i used a fixed width as an example, but what if the width was, say, 50% and the user dragged the window size. i wanted the submit to change size along with the table.

    i don't think this is the possible though :wtc:
     
  4. Rob

    Rob OT Supporter

    Joined:
    Jul 6, 2002
    Messages:
    88,612
    Likes Received:
    36
    Location:
    Atlanta, GA
    Hmmm, it might be possible through some javascript. :dunno:
     
  5. samm

    samm Next in Line

    Joined:
    Dec 22, 2000
    Messages:
    2,630
    Likes Received:
    0
    Location:
    San Jose, CA
    make the button an image
    <input type="image" width=xxx height=xxx src="pathto/image.gif" onclick="document.forms['yourformanem'].submit();">
     
  6. EvilSS

    EvilSS New Member

    Joined:
    Jun 11, 2003
    Messages:
    5,104
    Likes Received:
    0
    Location:
    STL
    try adding:
    Code:
     style="WIDTH: 300px" 
    to the button tag
     
  7. Aimless

    Aimless Resident drunkey

    Joined:
    Nov 5, 2001
    Messages:
    2,534
    Likes Received:
    0
    Location:
    Wisconsin
    Code:
    <html>
    <body>
    <table width=50%>
    <tr>
    <td>
    <input type=submit name="yay" value="yay" [COLOR=Red]style="width:100%"[/COLOR]>
    </td>
    </tr>
    </table>
    
    </body>
    </html>
    I think that's what you're looking for.
     
  8. carlin

    carlin Guest

    is this what you are looking for???
    Code:
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <script>
    function resizeBish(){
    	document.all["Submit"].value = "asdasd";
    	document.all["Submit"].width = "600";
    }
    </script>
    </head>
    
    <BODY onResize="resizeBish()">
    <form name="form1" id="form1" method="post" action="">
      <input type="submit" name="Submit" value="button" />
    </form>
    </body>
    </html>
    
     
  9. Rob

    Rob OT Supporter

    Joined:
    Jul 6, 2002
    Messages:
    88,612
    Likes Received:
    36
    Location:
    Atlanta, GA
    I think what carlin posted will work, it is the only one that does dynamic resizing.
     
  10. Aimless

    Aimless Resident drunkey

    Joined:
    Nov 5, 2001
    Messages:
    2,534
    Likes Received:
    0
    Location:
    Wisconsin
    :nono:
     
  11. Rob

    Rob OT Supporter

    Joined:
    Jul 6, 2002
    Messages:
    88,612
    Likes Received:
    36
    Location:
    Atlanta, GA

    :cool: I missed the "%" in yours. :eek3:

    And yours does it in less code. :bigthumb:
     
  12. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    CSS = :cool:
     
  13. crotchfruit

    crotchfruit Guest

    you are my god now. :bowdown:
     
  14. carlin

    carlin Guest

    i just wanted to see if there is a way to do it in JS... when I got it to work i posted the src... css > js
     

Share This Page