var timer; // Declare timer variable globally var isPaused = true; // Initialize the slideshow state function startSlideshow() { if (!isPaused) { timer = setTimeout(function() { window.location.href = encodeURI(encodeURI("${contextPath}/decision/view/form?viewlet=doc/JS/表单JS实例/01-JS实现暂停和继续轮播frm报表2.frm")); }, 2000); // Slideshow interval } } function stopSlideshow() { clearTimeout(timer); } function updateSlideshowState() { var ratioValue = $("[widgetname=RATIO]").val(); // Get the value of the "RATIO" control if (ratioValue === "true") { isPaused = false; startSlideshow(); } else { isPaused = true; stopSlideshow(); } } $("[widgetname=RATIO]").on("change", function() { updateSlideshowState(); // Update slideshow state when "RATIO" value changes }); // Initial update of slideshow state updateSlideshowState(); |
0
|
|