HTML Javascript字体大小更改

时间:2017-07-04 11:27:10

标签: javascript html fonts

<html>
<head>
  <meta charset="utf-8">
  <script>
    function test(){
      var name = document.getElementById('name').value;
      var snumber = document.getElementById('snumber').value;
      document.write("name="+name+"");
      document.write("&snumber="+snumber+"<br />");
    }
  </script>
</head>

<body>
   <h2>Example of sending data using POST</h2>
     Name :
   <input type="text" id="name"><br/>
     Student number:
   <input type="text" id="snumber"><br/><br/>
   <input type="button" value="submit" onclick="test();">
</body>
</html>

我想将第6行和第7行的字体大小更改为h2大小 我可以通过添加

来改变身体部分
 <h2></h2> 

然而,它不适用于脚本部分。如果我在名称和狙击部分输入数据,它连接到一个新页面,显示输入,如“name = David&amp; snum = 21467564”我希望这个字体大小为h2大小!

6 个答案:

答案 0 :(得分:1)

只需添加h2代码

即可

单行输出:

function test(){
      var name = document.getElementById('name').value;
      var snumber = document.getElementById('snumber').value;
    
 document.write("<h2>name="+name+"");
 document.write("&snumber="+snumber+"</h2> <br/>");
 }
<h2>Example of sending data using POST</h2>
     Name :
   <input type="text" id="name"><br/>
     Student number:
   <input type="text" id="snumber"><br/><br/>
   <input type="button" value="submit" onclick="test();">

对于多行输出:只需关闭<h2>标记并启动新的标题标记,如:

document.write("<h2>name="+name+"</h2>");
document.write("<h2>snumber="+snumber+"</h2><br />");

答案 1 :(得分:0)

你可以这样做:

<script>
function test(){
 var name = document.getElementById('name').value;
 var snumber = document.getElementById('snumber').value;
 document.write("<h2>name="+name+"</h2>");
 document.write("<h2>&snumber="+snumber+"</h2><br />");
}
</script>

答案 2 :(得分:0)

简单!只需添加h2元素。

&#13;
&#13;
'...opening resultWorkbook and dataWorkbook
For aRow = 6 To 9
            resultWorkbook.Worksheets("B3").Cells(aRow, 125).Value = _
                betterSearch(resultWorkbook.Worksheets("B3").Cells(aRow, 1) _
                , dataWorkbook.Worksheets("page 1").Range("A:A") _
                , dataWorkbook.Worksheets("page 1").Range("Z:Z"))

             resultWorkbook.Worksheets("B3").Cells(aRow, 126).Value = _
                betterSearch(resultWorkbook.Worksheets("B3").Cells(aRow, 1) _
                , dataWorkbook.Worksheets("page 1").Range("A:A") _
                , dataWorkbook.Worksheets("page 1").Range("I:I"))
Next aRow
&#13;
function test(){
 var name = document.getElementById('name').value;
 var snumber = document.getElementById('snumber').value;
 document.write("<h2>name="+name+"</h2>");
 document.write("<h2>&snumber="+snumber+"</h2>");
}
&#13;
&#13;
&#13;

答案 3 :(得分:0)

尝试这个

function test(){
 var name = document.getElementById('name').value;
 var snumber = document.getElementById('snumber').value;
 document.write("<h2>name="+name+"</h2>");
 document.write("<h2>snumber="+snumber+"</h2><br />");
}
<h2>Example of sending data using POST</h2>
Name :
<input type="text" id="name"><br/>
Student number:
<input type="text" id="snumber"><br/><br/>
<input type="button" value="submit" onclick="test();">

答案 4 :(得分:0)

function test(){
      var name = document.getElementById('name').value;
      var snumber = document.getElementById('snumber').value;
    
 document.write("<h2>name="+name+"</h2>");
 document.write("<h2>&snumber="+snumber+"</h2> <br/>");
 }
<h2>Example of sending data using POST</h2>
     Name :
   <input type="text" id="name"><br/>
     Student number:
   <input type="text" id="snumber"><br/><br/>
   <input type="button" value="submit" onclick="test();">

答案 5 :(得分:0)

b_can_view(b.*)