JavaScript 字串 - sup() 方法



描述

此方法導致字串顯示為上標,就像它在<sup>標籤中一樣。

語法

其語法如下:

string.sup( )

返回值

返回帶有<sup>標籤的字串。

示例

嘗試以下示例。

<html>
   <head>
      <title>JavaScript String sup() Method</title>
   </head>
   
   <body>   
      <script type = "text/javascript">
         var str = new String("Hello world");
         alert(str.sup());
      </script>      
   </body>
</html>

輸出

<sup>Hello world</sup>
javascript_strings_object.htm
廣告