所以我希望能够在页面上找到某个类时弹出警报。我希望在计时器之后执行此操作,并且每个类只执行一次,因此不是每次刷新。我有一个显示不同警报的网站,并希望在发生sevirty1时弹出窗口。我现在的代码是:
<tr id="31245a15-1815-4872-9631-59e885552933" class="severity1">
<td>
<img class="icon alertIcon" src="/csm/images/icons/event_viewer.png" data-original-title="Event Log Alert">
</td>
<td>
<a href="/csm/profile/alerts/124234">Evy (Previder)</a> :
<a href="/csm/device/alerts/13085950">VDC-EX01</a> :
<a href="/csm/monitor/alertDetailsAjax/31245a15-1815-4872-9631-59e885552933" class="alert_detail_link fancybox.ajax" onclick="return false;">
OALGen skipped some entries in the offline address list '\Global Address List'. To see which entries are affected, event loggin ... (Code: '' - Type: 'Critical, Error, Warning' - Desc: '')
</a>
</td>
<td align="right">
<span class="time" data-original-title="2018-06-06 06:09:12 CEST">
4 hours ago
</span>
</td>
</tr>
<script type="text/javascript">
var countdown = 180;
$('clock').update(new Date());
setInterval(updateClock, 1000);
function updateClock() {
$('clock').update(new Date());
$('countdown').update(countdown--);
if (countdown < 1) {
refreshKiosk();
countdown = 180;
}
}
function refreshKiosk() {
widgetBody('asset_widget', true);
widgetBody('component_widget', true);
widgetBody('job_widget', true);
widgetBody('alerts_widget', true);
updateAlertsWidget('kiosk=true', true);
countdown = 180;
}
function FindClass() {
var check = document.getElementsByName("severity1");
if(check)
{
alert('Did not expect it');
}
}
</script>
它不刷新页面只有警告,所以如果找到了servirty1类,弹出窗口需要显示。