change background color submit buttons.

Posted on 2004-11-16
Last Modified: 2010-04-06

I want to change the background color of 2 types of submit button...code might be the same but don't want to ask twice.

          <input name="submit" type="submit"  align="absmiddle" style=";text-align:center"    onClick="this.form.keywords.value =; this.form.action = '';" value="health">


<button type="submit" name="submit" align="absmiddle">Search in Open Directory&nbsp;<b><?=$displayOnlyInCat?></b>&nbsp;Category</button>
Question by:macuser777
    LVL 23

    Expert Comment

    to be honest as far as my knowledge does, i dont think you can.  But could you not make your own buttons and make them submit the form:

    <a href="javascript:document.Form1.submit()"><img...></a>
    LVL 53

    Accepted Solution

    <input name="submit" type="submit"  align="absmiddle" style="text-align:center;background-color:blue;"    onClick="this.form.keywords.value =; this.form.action = '';" value="health">


    <button type="submit" name="submit" align="absmiddle" style="background-color:red;">Search in Open Directory&nbsp;<b><?=$displayOnlyInCat?></b>&nbsp;Category</button>

    LVL 3

    Expert Comment

    Also , just for your info, you can assign a background image:

    style="background-image: url(marble.gif) "

    More information about background properties of elements can be found here:
    LVL 4

    Author Comment

    ... I may have found a roundabout is messy way of dealing with browser problems using td's and br's....
    LVL 4

    Author Comment


    sorry that message was meant to come after 1 thought i'd posted abiut an hour ago saying thatnk's very much but that I was aslo having some allignment problems..... when I post in old look It often cuts off my message of jusy doesn't accept it all now as well it seems.

    Sorry, CobolDinisaur...your solution was perfect...I was just having a couple of usual mac problems which there is no need to go into again now as I have found a way around.


    LVL 53

    Expert Comment

    Glad we could help.  Thanks for the A. :^)


    Featured Post

    Course: HTML5 Specialist

    HTML5 development skills are critical to all developers. HTML5 is the foundation to almost any development process. That's why business, design studios, development shops and other organizations need HTML5 developers. Get your foot in the door as a HTML5 specialist.

    Join & Write a Comment

    Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System ( introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
    What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to count occurrences of each item in an array.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now