Вопрос

I have made this simple search box and want to use an svg image as the submit button, how could I do that without any javascript?

here's the form:

    <form method="post" action="#">
        <input type="text" name="rechercher" id="rechercher" placeholder="Rechercher"/>
        <input type="submit" value="none" onerror="this.onerror=null; this.src='images/loupe.png'"/>
    </form>
Это было полезно?

Решение

You can use an image button on the button

<input type=image src=PATH_TO_YOUR_IMAGE alt="Submit Me">

or set submit button background to an image using css

input[type=submit] {
    background:url(BACKGROUND_IMAGE_PATH_HERE);
    border:0;
    display:block;
    height:Change_TO_backgroundimageheight;
    width: Change_To_backgroundimageWidth;
}

Другие советы

<form action="demo_form.asp">
First name: <input type="text" name="fname"><br>
<input type="image" src="submit.gif" alt="Submit">
</form>

The long and short is input type image will also submit the form

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top