如何在HTML中使用链接而不是按钮?

时间:2014-01-17 16:31:30

标签: html servlets

考虑以下index.html:

<!-- Product Inventory , 2014 -->

<!-- 

Inventory management tools are used in many different industries to keep track of products and their quantities.
In this project, we’ll create a simplified version of these tools. 
The basic requirements are as follows:
-Store product name, quantity, price, numeric ID and category.
-Search for products by price, ID or name.
-Quick overview of current inventory, including quantities of different products sorted by category.
-Updating the database dynamically as a product is ‘checked out’ or removed from the system.

 -->

<%@ page language="java" 
    contentType="text/html; charset=windows-1256"
    pageEncoding="windows-1256"
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
    <title>Product Inventory Shop 2014</title>
    <link rel="stylesheet"
          href="./css/styles.css"
          type="text/css"/>

    <link rel="stylesheet"
          href="./css/bar.css"
          type="text/css"/> 
</head>


<div id ="right" class="bar">
<a href="exitTheProgram">GET OUT!</a> 
</div>

<body>
<table class="title">
  <tr><th>Shop Inventory Program</th></tr>
</table>

<br/>
<fieldset>
  <legend>
  Welcome ! Please enter your Username and Password

  </legend >
  <form action="loginPage"> 
    <strong>USERNAME</strong>: <input type="text" name="username"><br>
    <strong>PASSWORD</strong> : <input type="password" name="password"><br>
    <input type="submit" value="Login">
  </form>

  <form action="RegisterPage"> 
  <strong> Or click here to <input type="button" value="Register"> </strong>
  </form>
</fieldset>

<br/>
<br/>
<br/>
<br/>
<br/><br/><br/><br/><br/><br/>
</body></html>

预览:

enter image description here

如何使用链接而不是“注册”框?

意思是,我想要链接(当鼠标悬停在&#34;注册&#34;字时出现的一只手)并将其转发给某个Servlet。 (是的,我知道它非常丑陋,我正在研究它......))

3 个答案:

答案 0 :(得分:3)

而不是

  <form action="RegisterPage"> 
  <strong> Or click here to <input type="button" value="Register"> </strong>
  </form>

使用

  <strong> Or click here to <a href="#link">register</a> </strong>

答案 1 :(得分:2)

使用以下内容:

<a href="putregisterlinkhere">Register</a>

a表示锚点。 href是链接的网址;目的地。将putregisterlinkhere替换为注册页面的URL

答案 2 :(得分:1)

请勿使用表格。

使用简单的链接......

Or click here to <a href="register_page.php">Register</a>