473,804 Members | 3,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to highlight some text in an iframe by script?

hi, all
I have an iframe in my page. Actually what I want is just like the google
search.
When user clicks search, I will load the a page from another URL into iframe
and then highlight the key words in the iframe.
Does anyone know how to do this? By JS or VBScript?

Thanks
Nov 18 '05 #1
3 3272
If you look at the HTML source of a google search page with highlighting,
you will find that the highlighted words are enclosed by <b> tags. I assume
they loop through all elements on the page to find the words to highlight,
i.e. to enclose with <b>, in the element's innerText property.

Eliyahu

"Nicky" <Ni***@discussi ons.microsoft.c om> wrote in message
news:65******** *************** ***********@mic rosoft.com...
hi, all
I have an iframe in my page. Actually what I want is just like the google
search.
When user clicks search, I will load the a page from another URL into iframe and then highlight the key words in the iframe.
Does anyone know how to do this? By JS or VBScript?

Thanks

Nov 18 '05 #2
Thanks for your reply.
Now I got a problem when I try to loop through all elements. How to get
these? I tried :
str = window.frames['myframe'].body.innerHTML
and it tells me "Can not access", or "Access is deny".

"Eliyahu Goldin" wrote:
If you look at the HTML source of a google search page with highlighting,
you will find that the highlighted words are enclosed by <b> tags. I assume
they loop through all elements on the page to find the words to highlight,
i.e. to enclose with <b>, in the element's innerText property.

Eliyahu

"Nicky" <Ni***@discussi ons.microsoft.c om> wrote in message
news:65******** *************** ***********@mic rosoft.com...
hi, all
I have an iframe in my page. Actually what I want is just like the google
search.
When user clicks search, I will load the a page from another URL into

iframe
and then highlight the key words in the iframe.
Does anyone know how to do this? By JS or VBScript?

Thanks


Nov 18 '05 #3
this cannot be done with javascript due to security issues. javascript code
can only access windows loaded from the same site. you will have to use the
google approach. rather than an iframe, their website fetches the page,
modifies the content, then returns it with google headers and footers. see
the webclient class.

-- bruce (sqlwork.com)

"Nicky" <Ni***@discussi ons.microsoft.c om> wrote in message
news:69******** *************** ***********@mic rosoft.com...
| Thanks for your reply.
| Now I got a problem when I try to loop through all elements. How to get
| these? I tried :
| str = window.frames['myframe'].body.innerHTML
| and it tells me "Can not access", or "Access is deny".
|
| "Eliyahu Goldin" wrote:
|
| > If you look at the HTML source of a google search page with
highlighting,
| > you will find that the highlighted words are enclosed by <b> tags. I
assume
| > they loop through all elements on the page to find the words to
highlight,
| > i.e. to enclose with <b>, in the element's innerText property.
| >
| > Eliyahu
| >
| > "Nicky" <Ni***@discussi ons.microsoft.c om> wrote in message
| > news:65******** *************** ***********@mic rosoft.com...
| > > hi, all
| > > I have an iframe in my page. Actually what I want is just like the
google
| > > search.
| > > When user clicks search, I will load the a page from another URL into
| > iframe
| > > and then highlight the key words in the iframe.
| > > Does anyone know how to do this? By JS or VBScript?
| > >
| > > Thanks
| >
| >
| >
Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
4538
by: David Morgan | last post by:
Hello I have a little function to highlight text if it exists. Function Highlight(vFind, vSearch) Dim RegEx Set RegEx = New RegExp RegEx.Pattern = vFind RegEx.IgnoreCase = True Highlight = RegEx.Replace(vSearch, "<span class=""Highlight"">" & vFind &
4
1623
by: Treetop | last post by:
I have code that works in IE but not Netscape 7+. This code allows me to have a list of links that bring up an image and description in an iframe. This works great in IE, however I have users that are Netscape users. main page: var links=new Array();
3
4367
by: tungchau81 | last post by:
Hi, A Modal Dialog does not allow us to highlight the text content inside <DIV> tag unless I use a <textarea> tag to display that text content. However, the situation of my software makes it impossible to use <textarea> and Modeless dialog. I am really stuck!!! Is there any trick to make <DIV> or <SPAN>'s content be selectable in a Modal dialog? Thanks in advance,
1
5337
by: john woo | last post by:
Hi I'm not good at JS, but want to get more about it. I want to use a JSP (the java code just used to get date, the rest are html and javascript), to display a table. the requirement is the all rows in even number in light-blue, rows in odd number in light gray, when a mouse clicks on a row, this row gets highlighted and in yellow, and it keeps highlighted
15
20585
by: Aaron Gray | last post by:
<iframe name="iframe" width="100%" height="25%" src="test1.txt"> </iframe> <a href="test1.txt" target="input">one</a> <a href="test2.txt" target="input">two</a> <form name="form1"> <textarea name="textarea" cols=80 rows=18> This is a test </textarea><br>
1
6191
by: tilt | last post by:
Hello, I use an object element to replace the iframe element in ie, like this: <object id="x_obj" data="http://.../" type="text/html"> <iframe name="x_if" id="x_if" src="http://.../">
1
2989
by: hrpreet | last post by:
Hi All, On click of a link , the contents get displayed in an iframe. Is there a way to search some text in the content displayed in the iframe and highlight it. Thanks.
2
2928
by: Celeste | last post by:
Hello, I'm trying to parse the referring url for google search terms so that when this page loads it will scroll to and highlight the search term(s). Should i be using document.referrer? Please take a look at my code and tell me what i'm doing wrong: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <title>highlight</title>
4
6845
by: sangam56 | last post by:
Hi all. I have an iframe in an asp.net web page (Display.aspx). <iframe id="iframe1" runat="server" src="temp/test.html"></iframe> Now I need to highlight a search text, say 'test' in the Display.aspx page. The source of iframe is dynamically assigned and search text is also changeable. This means I am dealing with dynamic search text and html page. Please suggest me how could I highlight the search texts in the iframe placed in the...
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10564
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10320
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10073
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9134
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7609
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5513
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3806
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.