473,396 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 3241
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***@discussions.microsoft.com> wrote in message
news:65**********************************@microsof t.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***@discussions.microsoft.com> wrote in message
news:65**********************************@microsof t.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***@discussions.microsoft.com> wrote in message
news:69**********************************@microsof t.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***@discussions.microsoft.com> wrote in message
| > news:65**********************************@microsof t.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
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 =...
4
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...
3
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...
1
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...
15
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...
1
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"...
1
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
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? ...
4
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.