【问题标题】:Dreamweaver link to button CS6Dreamweaver 链接到按钮 CS6
【发布时间】:2013-06-13 16:24:07
【问题描述】:

好的.. 这可能是一个愚蠢的问题,但我是 Dreamweaver 的新手。我知道右键单击-> 建立链接选项为您提供了将选定文本链接到另一个页面的选项。我试图用一个按钮做同样的事情,但右键单击一个按钮并没有给出制作链接按钮。如何制作一个按钮,点击后会转到另一个页面?

我正在尝试复制一个谷歌主页,这是我迄今为止的代码。

<body>
<div align="center">
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p><img src="logo.jpg" width="281" height="114" /></p>
  <p>
    <label for="textfield"></label>
    <input name="textfield" type="text" id="textfield" value="" size="100" />
  </p>
  <p>
    <input name="Button 1" type="submit" id="Button 1" value="Google Search" />
    &nbsp;  
     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
     <input type="submit" name="button2" id="button2" value="I'am Feeling lucky" />
  </p>
  <p>&nbsp;</p>
</div>
</body>

【问题讨论】:

    标签: button hyperlink dreamweaver


    【解决方案1】:

    您提到了 DreamWeaver,我不知道您是否想要仅使用 GUI 端的解决方案,或者您是否可以进入设计视图。我的回答是关于设计视图。

    你的输入类型是提交,你需要提交一个表单的内容!比如:

    <form action="googleResultReplcationPage.aspx" method="get">
      <p>
          <label for="textfield" />
          <input name="textfield" type="text" id="textfield" value="" size="100" />
      </p>
      <p>
          <input name="Button 1" type="submit" id="Button 1" value="Google Search" />
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
          <input type="submit" name="button2" id="button2" value="I'am Feeling lucky" />
      </p>
    </form> 
    

    要执行您想要的操作,您需要 JavaScript 并将类型更改为 Button。这显然只有在用户启用了 JavaScript 时才有效。

    <input type="button" value="Google Search" onClick="window.navigate('replicationGooglePage.aspx')">
    

    您可以使用 CSS 来解决此问题(您还需要创建悬停)

    <a href="#" class="button">some words</a>
    
    .button {
      display: block;
      width: 115px;
      height: 25px;
      background: #4E9CAF;
      padding: 10px;
      text-align: center;
      border-radius: 5px;
      color: white;
      font-weight: bold;
    }
    

    Source

    在这 3 个选项中,第一个建议是 IMO 是最好的方法。

    顺便说一句,不要使用&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;,因为它并不总是适用于所有浏览器(一些浏览器过去只读取第一个),而是使用样式/css 并使用LeftPaddingMargin(取决于您的代码/设置/设计)-尽管您最好使用website centered

    <form action="googleResultReplcationPage.aspx" method="get">
      <p>
          <label for="textfield" />
          <input name="textfield" type="text" id="textfield" value="" size="100" />
      </p>
      <p>
          <input name="Button 1" type="submit" id="Button 1" value="Google Search" />       
          <input type="submit" name="button2" id="button2" value="I'm Feeling lucky" style="margin-left:50px;" />
      </p>
    </form> 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多