图像作为提交按钮工作

时间:2013-05-15 08:42:49

标签: html css struts

我做了一些已经由之前的开发团队编写的代码,我遇到了一个代码snippt,它有点奇怪,所以请看看它并让我明白。

    <!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, 维尼特

2 个答案:

答案 0 :(得分:0)

input的类型为image时,它会充当提交按钮。它是规范的一部分。

  

image:图形提交按钮。您必须使用src属性   定义图像的源和要定义的alt属性   替代文字。您可以使用height和width属性   以像素为单位定义图像的大小。

Source

答案 1 :(得分:0)

组件的输入类型SRC属性设置为先前的图像

您的代码

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

下面的代码用作按钮。

<!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>
相关问题