Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,201,396 members, 7,978,261 topics. Date: Friday, 18 October 2024 at 12:42 AM |
Nairaland Forum / Science/Technology / Programming / Year As Heading On A Webpage (504 Views)
How To Style A Webpage / How to Create A Webpage Using Html And Host It Using W3space / I Need A Webpage And An App. (2) (3) (4)
Year As Heading On A Webpage by baggy4luv(m): 12:08pm On Oct 12, 2022 |
I want to use current year as heading as my h1.like 2022 verification exercise....then i want the year should be incremnting. |
Re: Year As Heading On A Webpage by LTCtech: 12:14pm On Oct 12, 2022 |
baggy4luv: What programming language? JS or PHP? |
Re: Year As Heading On A Webpage by baggy4luv(m): 12:15pm On Oct 12, 2022 |
LTCtech:Am a newbie either one |
Re: Year As Heading On A Webpage by Nobody: 3:33pm On Oct 12, 2022 |
baggy4luv: To get the current year in JavaScript, call the new Date() constructor to get a date object and call the getFullYear() method on the result, e.g. new Date(). getFullYear() . The getFullYear method will return a number corresponding to the current year. culled somewhere online |
Re: Year As Heading On A Webpage by LTCtech: 3:58pm On Oct 12, 2022 |
baggy4luv: Js
Cheers! |
Re: Year As Heading On A Webpage by baggy4luv(m): 4:55pm On Oct 12, 2022 |
LTCtech:Can it be used as the heading on a webpage |
Re: Year As Heading On A Webpage by LTCtech: 8:15am On Oct 13, 2022 |
baggy4luv: Yes. Just do
or you could get the h1 tag by id and do innerHTML |
Re: Year As Heading On A Webpage by truthCoder: 11:56am On Oct 14, 2022 |
1 Like 1 Share |
Re: Year As Heading On A Webpage by Zabiboy: 8:09pm On Oct 14, 2022 |
<h1 class="year" > </h1> <s.cript> var year = document.querySelector(".year") year.innerText = new Date().getFullYear() </s.cript> 1 Like |
Re: Year As Heading On A Webpage by remi1444: 8:37pm On Oct 15, 2022 |
Zabiboy:use let. ES6 has laid var to rest. 1 Like |
(1) (Reply)
Iphone Users / High Performance Coding Class: Website Design Tutorial / What Next After Learning Core JAVA, HTML And CSS
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 12 |