We help IT Professionals succeed at work.
Get Started

highlight words within iframe webpage

Last Modified: 2012-05-06

I would like to add anm input text and an input button to find and highlight words (simple or compung) inside the iframe placed webpage.

Very grateful for any help
The code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<script type="text/javascript">
// <![CDATA[
window.onload = function()
	var iframe_window = window.frames["my_iframe"];
	var iframe_body_html = iframe_window.document.getElementsByTagName("body")[0].innerHTML;
	//var html = http://virtual-economy.org.replace(/me/gi,"you"); //case-insensitive
	//var html = iframe_body_html.replace(/me/g,"you");
	//html = html.replace(/ME/g,"YOU");
	document.getElementById("output").innerHTML = html;
// ]]>
<iframe name="my_iframe" id="my_iframe" width=500 height=500 src="http://virtual-economy.org"></iframe>
<div id="output"></div>

Open in new window

Watch Question
IT Expert
Top Expert 2009
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE