In order to run a script in the infobox, you have to enable scrips to run in the iframe. This is disabled by default for security reasons, in case you don’t know the source of the data populating the infobox.
You can enable scrips with this code:
var iframe = document.getElementsByClassName('cesium-infoBox-iframe')[0]; iframe.setAttribute('sandbox', 'allow-same-origin allow-scripts allow-popups allow-forms');
Also, to get the current value of an entity property, you can use .getValue(viewer.clock.currentTime);