2014-04-11 54 views
-2

請找到下面的鏈接,從Firefox瀏覽器中打開這個想打破文本輸入按鈕

http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_type_button

,而不是

value="Click me"

下面一行字代替。

value="I want to break this sentence and make it fix width size like 400px and height should be auto." 

需要打破這個按鈕400px寬度和高度應該是自動根據我們有多長的句子。

我現有的代碼是

<input type="button" style="display: none; background: none!important; border: none; 
          padding: 0!important; 
border-bottom: 1px solid #444; cursor: pointer; max-width: 400px; word-wrap: break-word;" onclick="openDrugsPopup(this);" 
          id="lnkdrg2" name="lnkdrg2" value="Drug 2" /> 
+0

我們需要知道你已經嘗試了一個。 – Daedalus

+0

使用['textarea'](http://www.w3.org/MarkUp/html3/textarea.html)。 –

+0

回答

0
<!DOCTYPE html> 
<html> 
    <head> 
     <script> 
      function msg() 
      { 
       alert("Hello world!"); 
      } 
     </script> 
    </head> 
<body> 

    <form> 
     <input type="button" value="I want to break this sentence and make it fix widht size like 400px and height should be auto. any one can help to resolve this issue asap."  onclick="msg()" style="width=400px; height=auto;"> 
    </form> 

    <p>The button above activates a JavaScript when it is clicked.</p> 

</body> 
</html> 
+0

此代碼不適用於Firefox。 – Chetan

3

使用代替,讓寬度該按鈕的高度相應增加文本增加

<button style="width:100px"> 
    I want to break this sentence and make it fix widht size like 400px 
     and height should 
     be auto. any one can help to resolve this issue asap. 
    </button> 

這在所有的瀏覽器工作正常。