Results 1 to 9 of 9

Thread: Input type error cross browser layout

  1. #1
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    472
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default Input type error cross browser layout

    Hi, i have problem with google chrome:
    I make an input box for login, it should look like this one in FF:


    But it appear like this in chrome, safari, & IE.7


    This is input code:
    Code:
    <input type="image" class="login" onclick="javascript:ajaxpage('content/do-login.html', 'kolomlogin');"/>
    This is the CSS:
    Code:
    .login {
    	display: block;
    	width: 67px;
    	height: 32px;
    	background: url('images/button/login.png') bottom;
    }
    .login:hover {
    	background-position: 0 0;
    }
    And This is the Image:


    So is there any problem with my css code?
    Thank you for your attention
    Last edited by davelf; 03-09-2011 at 02:28 AM. Reason: My Problem is Solved
    _____________________

    David Demetrius // davejob
    _____________________

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    What if you just add value="" to the login button input tag?
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  3. #3
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    472
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default

    ya i already try that too, it's not work.
    _____________________

    David Demetrius // davejob
    _____________________

  4. #4
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    472
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default

    I used this line of code to cover it:

    Code:
    <a href="#" class="login" onclick="javascript:ajaxpage('content/do-login.html', 'kolomlogin');"></a>
    i try this to :
    Code:
    <input type="file" class="login" onclick="javascript:ajaxpage('content/do-login.html', 'kolomlogin');"/>
    but this doesn't work either.

    is that mean that i can't use image for my button. Or like my first question, is there any problem the way i call the css sprite?
    _____________________

    David Demetrius // davejob
    _____________________

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I believe that an image input uses the src attribute just like a regular img tag.
    Try adding this to the tag:
    src="yourimage.jpg"

    I'm not sure how you can have the special styling and the image, but it should work to at least remove the default text.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    472
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default

    the reasons that i using "class" instead direct "src" is the hover.
    That's why i use css sprite too, hehe

    So any other option
    _____________________

    David Demetrius // davejob
    _____________________

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    djr33 is right. You need a src attribute. The reason it looks different in Firefox is that in Firefox, the broken image token isn't displayed as frequently (in less situations) as it is in other browsers. For what you are doing a transparent .gif image may be used. That way there should be no broken image token:

    Code:
    <input src="transparent_67_32.gif" type="image" class="login" onclick="javascript:ajaxpage('content/do-login.html', 'kolomlogin');"/>
    For best results, make this transparent .gif conform to the dimensions:

    Code:
    .login {
    	display: block;
    	width: 67px;
    	height: 32px;
    	background: url('images/button/login.png') bottom;
    }
    .login:hover {
    	background-position: 0 0;
    }
    Like:



    It's there, you just can't see it. If you hover over it, you may right click and save it. Or use this link:

    http://home.comcast.net/~jscheuer1/s...rent_67_32.gif

    You still won't be able to see it. Or use this:

    http://home.comcast.net/~jscheuer1/s...rent_67_32.htm

    where I've put it in a div of the same dimensions and given the div a background color.
    Last edited by jscheuer1; 03-09-2011 at 04:01 AM. Reason: add page link, later - spelling
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. The Following User Says Thank You to jscheuer1 For This Useful Post:

    davelf (03-09-2011)

  9. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Even better, use a button type input:

    Code:
    <input type="button" class="login" onclick="ajaxpage('content/do-login.html', 'kolomlogin');"/>
    css:

    Code:
    .login {
    	display: block;
    	width: 67px;
    	height: 32px;
    	background: url('images/button/login.png') bottom;
    	border-width: 0;
    }
    .login:hover {
    	background-position: 0 0;
    }
    Notes:

    • For the onclick event of an element, the prefix javascript: is not required.

    • No transparent .gif is needed.

    • Since no image is involved, display: block; could be removed, unless you need the line breaks.
    Last edited by jscheuer1; 03-08-2011 at 04:16 PM. Reason: streamline, flesh out notes
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. The Following User Says Thank You to jscheuer1 For This Useful Post:

    davelf (03-09-2011)

  11. #9
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    472
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default

    ah i understand now that's what Daniel mean.

    Thanks you so much John, it's perfect.
    _____________________

    David Demetrius // davejob
    _____________________

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
  •