JavaScript Learning-the enlargement and reduction of paragraph font

Source: Internet
Author: User

Note: The CSS style in JavaScript differs from the styles in non-JavaScript, in non-JavaScript style font size: Font-size, and in JavaScript it is fontsize.

In a style other than JavaScript, "-" is rewritten with the second letter capitalized

<! DOCTYPE html>

<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>

<title></title>

<style type= "Text/css" >

. Re {

Background-color:gray;

font-weight:200;

padding:30px;

}

</style>

<script type= "Text/javascript" >


Window.onload = function () {

var btnbig = document.getElementById (' big ');

var btnlit = document.getElementById (' litter ');

var btnstyle = document.getElementById (' Btnstyle ');

var p1 = document.getElementById (' pnew ');

var FZ = 12;

Amplification

Btnbig.onclick = function () {

fz++;

P1.style.fontSize = fz+ "px";

}

Narrow

Btnlit.onclick = function () {

if (FZ > 0) {

fz--;

P1.style.fontSize = FZ + "px";

}

else {

Alert ("No more small!" ");

}

}

Set format

Btnstyle.onclick = function () {

P1.classname = ' re ';

}

}


</script>

<body>

<input type= "button" id= "Big" value= "grow"/>

<input type= "button" id= "litter" value= "Zoom Out"/>

<input type= "button" id= "Btnstyle" value= "set style"/>

<p id= "Pnew" >

He said that in the past three weeks, the police have dealt with the illegal behaviour of demonstrators in an extremely tolerant manner,

The aim is to hope that the people concerned can calm down and

To express their demands in a peaceful, rational and lawful manner. It is a pity that they are still unchanged,

Even worse. These illegal acts are constantly hurting Hong Kong, making it impossible for school to go to school, to work normally,

Business can not be normal business, sick people can not normal visits, all walks of life are very serious impact.

</p>


</body>


This article is from the "Day to Up" blog, so be sure to keep this source http://1433189426.blog.51cto.com/8055494/1565730

JavaScript Learning-the enlargement and reduction of paragraph font

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.