0

我做了一些以前的开发团队已经编写的代码,我遇到了一个代码片段,它的行为有点奇怪,所以请看一下,让我理解。

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML Strict//EN">
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<HTML>
    <HEAD>
    </HEAD>
    <BODY id="ext-gen6" class=" ext-ie ext-ie6 ext-border-box"
        leftMargin="0" rightMargin="0" topMargin="0" marginheight="0"
        marginwidth="0">
        <TABLE border="0" cellSpacing="0" cellPadding="0" width="100%"
            height="100%">
            <TBODY>
                <TR>
                    <TD height="85%" vAlign="top" width="80%">
                        <DIV>
                            <TABLE class="allcolors" border="0" width="100%">
                                <TBODY>
                                    <TR>
                                        <TD>
                                            <TABLE border="0" cellSpacing="0" borderColor="#6699cc"
                                                cellPadding="0" width="100%" height="685">
                                                <TBODY>
                                                    <TR>
                                                        <TD class="threecolors" vAlign="top">


                                                                        <FORM id="Report1"
                                                                            encType="multipart/form-data"
                                                                            onsubmit="ProgressBar()" method="post"
                                                                            name="Form2"
                                                                            action="/cgfsampling/assignReport.do">

                                                                                <INPUT id="assign" 
                                                                                    src="http://localhost:8080/myProj/images/cation.gif"
                                                                                    type="image" name="" value="" />

                                                                         </FORM>

                                                                     </TD>


                                                    </TR>
                                                </TBODY>
                                            </TABLE>
                                        </TD>
                                    </TR>
                                </TBODY>
                            </TABLE>
                        </DIV>
                    </TD>
                </TR>
            </TBODY>
        </TABLE>
    </BODY>
</HTML>

所以请让我知道为什么图像用作提交按钮

Thnaks,维内特

4

2 回答 2

0

When the type of an input is image it acts as a submit button. Its part of the specification.

image: A graphical submit button. You must use the src attribute to define the source of the image and the alt attribute to define alternative text. You can use the height and width attributes to define the size of the image in pixels.

Source

于 2013-05-15T08:47:04.627 回答
0

The input type SRC attribute of the component was set to image earlier.

Your code

  <INPUT id="assign" src="http://localhost:8080/myProj/images/cation.gif" type="image" name="" value="" />

Below code works as a button.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML Strict//EN">
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<HTML>
<HEAD>
</HEAD>
<BODY id="ext-gen6" class=" ext-ie ext-ie6 ext-border-box"
      leftMargin="0" rightMargin="0" topMargin="0" marginheight="0"
      marginwidth="0">
<TABLE border="0" cellSpacing="0" cellPadding="0" width="100%"
       height="100%">
    <TBODY>
    <TR>
        <TD height="85%" vAlign="top" width="80%">
            <DIV>
                <TABLE class="allcolors" border="0" width="100%">
                    <TBODY>
                    <TR>
                        <TD>
                            <TABLE border="0" cellSpacing="0" borderColor="#6699cc"
                                   cellPadding="0" width="100%" height="685">
                                <TBODY>
                                <TR>
                                    <TD class="threecolors" vAlign="top">


                                        <FORM id="Report1"
                                              encType="multipart/form-data"
                                              onsubmit="ProgressBar()" method="post"
                                              name="Form2"
                                              action="/cgfsampling/assignReport.do">

                                            <INPUT type='submit' id="assign"
                                                    name="" value="Submit" />

                                        </FORM>

                                    </TD>


                                </TR>
                                </TBODY>
                            </TABLE>
于 2013-05-15T08:47:56.290 回答