Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Read alt/title text on iPhone OS devices via bookmarklet' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Read alt/title text on iPhone OS devices via bookmarklet
Authored by: stephenn on Apr 11, '10 04:12:36PM
Here's a version that shows the title/alt text in a window after tapping on an image. It should work with images that are also links.
javascript:for(var%20i%20in%20document.images)%7bfunction%20s()%7bif(this.title)%7balert(this.title)%7delse%20if(this.alt)%7balert(this.alt)%7delse%7balert('no%20alt%20text')%7d%7ddocument.images%5bi%5d.onclick=s%7d
and here's a version that adds the title/alt text to all images on the page without clicking.
javascript:function%20b(e,c)%7bfor(var%20i=0;i<c;i++)%7be.parentNode.insertBefore(document.createElement('br'),e.nextSibling)%7d%7dfor(var%20i%20in%20document.images)%7bvar%20e=document.images%5bi%5d;var%20t="";if(e.title)%7bt=e.title%7delse%20if(e.alt)%7bt=e.alt%7dif(t)%7bb(e,2);e.parentNode.insertBefore(document.createTextNode(t),e.nextSibling);b(e,2)%7d%7d


[ Reply to This | # ]
Read alt/title text on iPhone OS devices via bookmarklet
Authored by: stephenn on Apr 11, '10 10:16:33PM
And a version that combines the above scripts:
javascript:function%20b(e,c)%7bfor(var%20i=0;i<c;i++)%7be.parentNode.insertBefore(document.createElement('br'),e.nextSibling)%7d%7dfunction%20s()%7bvar%20t=this.title||this.alt||'No%20Text';alert(t)%7dfor(var%20i%20in%20document.images)%7bvar%20e=document.images%5bi%5d;var%20t=e.title||e.alt;if(t)%7bb(e,2);e.parentNode.insertBefore(document.createTextNode(t),e.nextSibling);b(e,2)%7de.onclick=s%7d


[ Reply to This | # ]