There are many ecommerce websites that have static coded checkout forms. For these forms, the code to populate the drop down lists for years may be hard coded, which presents longterm problems for your website. In cases where PHP or another suitable language is prohibited, you may be looking for a way to expand the year option of a field automatically. If so, you can insert this javascript in in place of the hard coded <option>s, it will set the years options to be the current and go up to 10 in the future.
This solution works great with Adobe Business Catalyst projects, where the original eCommerce form has been manually over-written (for whatever reason).
<script type="text/javascript">var d = new Date();
var curyr =d.getFullYear();
document.write('<option selected="true" value="'+curyr+'">'+curyr+'</option>');
for(cur=curyr;cur<curyr+11;cur++){
document.write('<option value="'+cur+'">'+cur+'</option>');
}</script>
by Jonathan Franchell, CEO of Ironpaper - For more tips and hacks: Need to remove a new line after h1 tags? Both web designers and SEO practitioners need to employ headline tags: H1, H2, H3 in several ways to improve web page structure and tag...
The Crowded Arena of the IT Marketplace Updated December 2024 The Information Technology (IT) landscape is experiencing rapid growth and intensifying competition. IT spending is projected to reach nearly 5.1 trillion U.S. dollars in 2024, a...
Updated December, 2024 The field of digital marketing is evolving rapidly in response to new technology and changing buyer expectations. To help career-minded marketers, we’ve rounded up the top 10 skills needed to succeed in the field. These are...