0
如果在父頁面的iframe中發現字符串,如何觸發函數?在父頁面的iframe中查找字符串
我需要改變這種用繩子,而不是元素ID的工作:
if (window.frames[0].document.getElementById('mystring'))
{
document.getElementById('Search').style.display = 'block';}
如果在父頁面的iframe中發現字符串,如何觸發函數?在父頁面的iframe中查找字符串
我需要改變這種用繩子,而不是元素ID的工作:
if (window.frames[0].document.getElementById('mystring'))
{
document.getElementById('Search').style.display = 'block';}
var source = window.frames[0].document.getElementsByTagName('html')[0].innerHTML;
var found = source.search("searchString");
你也可以使用source.indexOf("searchstring") != -1
謝謝,作品。 – marius
通過字符串中發現,你的意思與'id'元素被發現,或簡單地說,字符串存在於頁面上? – plalx
只是該字符串存在於頁面上。 – marius