kya
kya

Reputation: 1828

Convert an image button to a submit button

I've been given the following HTML and JavaScript by a front end designer. Now I tried different ways to convert it to a button: Below is the designers html

 <div id="detailsdiv" style="left:580px; width:100px;">
            <input type="image" name="submit" onMouseOver="lg.src='images/b_logB.png'" onMouseOut="lg.src='images/b_logA.png'" src="/Button1.jpg" border="0" alt="Submit" />
            <a href="home.html" onMouseOver="lg.src='images/b_logB.png'" onMouseOut="lg.src='images/b_logA.png'">
                <img src="images/b_logA.png" name="lg" class=style1></a>
        </div>

I tried this:

<input type="image" name="submit" onMouseOver="lg.src='images/b_logB.png'" onMouseOut="lg.src='images/b_logA.png'"
                   src="images/b_logB.png" border="0" alt="Submit" class="style1" />

But its not working, it just displays a the first button, it doesnt change on mouseOver

Upvotes: 1

Views: 363

Answers (2)

Tropilac
Tropilac

Reputation: 43

Can't you just open the Input tag and then have the img tag inside it?

<input type="submit"><img src="http://www.google.com/image.png"></input>

Upvotes: 0

Atikur Rahman
Atikur Rahman

Reputation: 552

you can try like this.......

<input type="image" name="submit" onMouseOver="this.src='images/b_logB.png'" onMouseOut="this.src='images/b_logA.png'" src="/Button1.jpg" border="0" alt="Submit" onclick="document.getElementById('formid').submit();" />

in onclick method of image the form is manually submitted by javascript.

this refers to image.

Upvotes: 4

Related Questions