Purpose: a lot of news on the same page, every news here has three said the number of regions, each region has a tag number display, a tag is a + 1, + 1, just click on the previous number will automatically add 1, because there are many of these areas, so I want to encapsulate a function to realize, thought of the object-oriented
Numbers in front of my idea is: will the label and the back of the + 1 label as a parameter, use a function to achieve the above operation, but want to for a long time did not realize, did find alternative methods at present, but I still want to know my this idea can be implemented? Thank you for your attention!
CodePudding user response:
The function add1 (id) {
Document. The getElementById (id). InnerText++;
}
</script>
CodePudding user response:
Thank you thank you! Skills learned! Happy, attach my stupid way!CodePudding user response:
<meta charset="utf-8">
<style type="text/CSS" & gt;
The dd {
Background - color: blue;
}
# ce {
border: 1px solid red;
Margin - bottom: 15 px;
Width: 200 px;
}
</style>
<body>
56