Avatar of josefkrzysztof
josefkrzysztof
 asked on

highlight words within iframe webpage

Hi,

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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Example</title>
<style type="text/css">
</style>
<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;
	}
 
// ]]>
</script>
</head>
<body>
 
<iframe name="my_iframe" id="my_iframe" width=500 height=500 src="http://virtual-economy.org"></iframe>
 
<div id="output"></div>
 
</body>
</html>

Open in new window

JavaScript

Avatar of undefined
Last Comment
Michel Plungjan

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Michel Plungjan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
josefkrzysztof

ASKER
Must I save my file as .hta?

After saving it as .hta could I create a input button to search words inside that iframe?

Best regards

Josef
Michel Plungjan

Yes  save as filename.hta and you can open it from your harddisc and do whatever you want since the security is low
Michel Plungjan

And the "B" grade was because?
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy