Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Regular Coder
    Join Date
    Jan 2011
    Posts
    136
    Thanks
    101
    Thanked 0 Times in 0 Posts

    textbox length changes between different browsers

    Is there a way I can set the length of the text box in terms of pixels (px), instead of using size="xx"?

    In some rows, I have more than one textboxes, in others the whole row is a textbox. The textboxes I created using the below code look different in different browsers.

    <input type="text" name=name size="25" maxlength="40"/>

    Please help.

  • #2
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,335
    Thanks
    5
    Thanked 363 Times in 360 Posts
    Quote Originally Posted by camaross View Post
    Is there a way I can set the length of the text box in terms of pixels (px), instead of using size="xx"?

    In some rows, I have more than one textboxes, in others the whole row is a textbox. The textboxes I created using the below code look different in different browsers.

    <input type="text" name=name size="25" maxlength="40"/>

    Please help.
    Shouldn't name=name actually be name="name"?

    Can you post a link to your live site?
    Teed

  • #3
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,253
    Thanks
    12
    Thanked 341 Times in 337 Posts
    Quote Originally Posted by teedoff View Post
    Shouldn't name=name actually be name="name"?
    that is allowed in HTML, as long as there are no spaces and other special characters in the attribute value.
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by camaross View Post
    Is there a way I can set the length of the text box in terms of pixels (px), instead of using size="xx"?

    In some rows, I have more than one textboxes, in others the whole row is a textbox. The textboxes I created using the below code look different in different browsers.

    <input type="text" name=name size="25" maxlength="40"/>

    Please help.
    i guess you talk about bw-contact, all the markup from html files is invalid. Is a usual habit of many programmes to write code in php, perl or javascript and mess css and html.
    You need to validate all the files from html folder and then to fix how it look.

    best regards

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Quote Originally Posted by camaross View Post
    Is there a way I can set the length of the text box in terms of pixels (px), instead of using size="xx"?

    In some rows, I have more than one textboxes, in others the whole row is a textbox. The textboxes I created using the below code look different in different browsers.

    <input type="text" name=name size="25" maxlength="40"/>

    Please help.
    Getting back on topic, browsers use different font sizes and font families for inputs. To get a more uniform look set a font family and the font-size. You may even want to set the margin and/or padding. And you can set the width. Have you heard of CSS? Use CSS to set the width. You could even change the border if you like.
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    input {
    	font-size:12px;
    	font-family:Verdana, Geneva, sans-serif;
    	margin:2px;
    	padding:2px;
    	width:200px;
    	border:1px solid #000;
    	/* remove the below or float this if you want text 
    	and/or elements next to the inputs
    	this is here for markup purposes */
    	display:block; 
    }
    </style>
    </head>
    
    <body>
    <form>
    <input type="text" name="name" size="25" maxlength="40" />
    <input type="text" name="name2" size="25" maxlength="40" />
    <input type="text" name="name3" size="25" maxlength="40" />
    <input type="text" name="name4" size="25" maxlength="40" />
    </form>
    </body>
    </html>
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #6
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    Getting back on topic, browsers use different font sizes and font families for inputs.
    op didn't said but he talk about bw-contact, and in this case fixing html doesn't help because will break the rest of the script who need to parse the html, so this is the topic. Anyway in case i'm wrong op can confirm this.

    best regards

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Quote Originally Posted by oesxyl View Post
    op didn't said but he talk about bw-contact, and in this case fixing html doesn't help because will break the rest of the script who need to parse the html, so this is the topic. Anyway in case i'm wrong op can confirm this.

    best regards
    What? What are you referring to when you say "bw-contact"? He asked how to get uniformed input boxes that are the same across multiple browsers. To that you set the font size, and font family, you can even set widths and other styling if you prefer.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #8
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    What? What are you referring to when you say "bw-contact"? He asked how to get uniformed input boxes that are the same across multiple browsers. To that you set the font size, and font family, you can even set widths and other styling if you prefer.
    http://cgi.bw.org/bw-contact/

    op try to solve a bigger problem by assembling solution for different pieces.

    best regards

  • #9
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    So are you saying why should he try to "reinvent" the wheel or something when there are forms already made out there?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #10
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    So are you saying why should he try to "reinvent" the wheel or something when there are forms already made out there?
    he work on something more complex then this script, i have no idea what and i didn't ask, but i help him to change some parts of the script. First time when i seen the html i was tempted to make it valid then i realised that is parsed by the script and if i change it i need to change also the part of the code who use this pages, so i give up since was not important in that moment.
    Anyway the script is better then many php i seen until now,

    best regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •