var table = document.getElementById('termine-table'); var oldhtml = table.innerHTML; function doSearch() { var search = document.getElementById('termine-input').value; if (search === '') { return doError(true); } var splitted = oldhtml.split(search); if (splitted.length > 1) { var html = splitted[0]; for (var i = 1; i < splitted.length; i++) { var id = ''; if (i === 1) { id = 'id="termine-span" '; } html += '' + search + '' + splitted[i]; } try { table.innerHTML = html; document.getElementById('termine-error').style.display = 'none'; document.getElementById('termine-span').scrollIntoView(); } catch (e) { doError(); } } else { doError(); } } function doError(hideWarning) { table.innerHTML = oldhtml; if (hideWarning) { document.getElementById('termine-error').style.display = 'none'; } else { document.getElementById('termine-error').style.display = 'block'; } } document.getElementById('termine-javascript').style.display = 'block'; doSearch();