var isBlonde = false; var body = gwndTarget.document.getElementById('style'); for (var i=0; i<body.length; i++) { if (body[i].indexOf("Blonde") > -1){ isBlonde = true; alert(1); } }
Would you consider using a framework like jQuery for your javascript operations?
It'd make your code much less bulky, if you plan on doing alot of tasks such as this.
Let me know, otherwise I can post a plain javascript answer.
Also, id's must be unique, so you can only use one instance of an individual id name (any attempt at javascript on your html would fail for this reason).
For classification of elements of the same name, use the class attribute instead of id:
For example:
It'd make your code much less bulky, if you plan on doing alot of tasks such as this.
Let me know, otherwise I can post a plain javascript answer.
Also, id's must be unique, so you can only use one instance of an individual id name (any attempt at javascript on your html would fail for this reason).
For classification of elements of the same name, use the class attribute instead of id:
For example:
Open in new window