Copy link to clipboard
Copied
hai pls help me out of this
Copy link to clipboard
Copied
In what context? A web-page? A PDF file? Something else? You need to provide more details...
Copy link to clipboard
Copied
Regardless of the application, JS has a Date object that can perform that comparison very simple using vanilla JS. It would be something like (ES5):
// create date to test and todays date
var testDate = new Date( '12/25/2018' ); // MM/DD/YYYY
var todaysDate = new Date(); // today, per the computer that's running the JS engine
// compare
if ( testDate.setHours(0,0,0,0) == todaysDate(0,0,0,0) ) {
// true, today
} else {
// false, not today
}
As for the image, if it's on the web or Acrobat or something else, we'll need to know. On the web the vanilla ES5 way is simply alter the 'src' property of the image, and hopefully give it a class or an ID so you can easily locate it. Plain ES5 e.g.:
<!-- HTML -->
<img src="images/mypic.png" id="someImage">
// JS
<script type='text/javascript'>
// wait for window to load
window.addEventListener( 'load', function() {
// change image .src attribute via ID
document.getElementById( 'someImage' ).src = 'images/anotherimage.png';
});
</script>