473,320 Members | 1,817 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,320 software developers and data experts.

Jumping in a frame using Javascript

Hi,

I have two horizontal frames, one on top of the other.

The top frame is an image map of a street with property boundary's on
it.

The bottom frame is a table with each row of the table holds details
about a perticular property from the image map above.

The user clicks on the image map in the top frame and the corresponding
row in the table is highlighted in the bottom frame.

The table is very long and the rows continue below the visable canvas.

What i need is a way to jump to the row when it is highlighted so that
it displays no matter where in the table it is located.

Is it possible to jump in a frame or page using Javascript?

Jul 23 '05 #1
17 1612
Here is the script I am using (just encase it helps someone get an idea
of what I mean).
"passdata" is the row id being passed in from the top frame. The row id
is used to find and highlight the corresponding row. What I really need
to do is to be able to use the row id to jump to a particular area of
the frame.

<script type="text/javascript">
<!--
var passdata = 1;
var oldpassdata = 1;

function Start() {
if(oldpassdata != passdata)
ShowPass();

id1 = setTimeout("Start();", 100); // check value every .1 sec.
}

function ShowPass() {
highlightrow(passdata);
oldpassdata = passdata;
}

function highlightrow(n){
clearallrows()
document.getElementById(n).style.backgroundColor=' #FFAABB';
}

function clearallrows(){
if (oldpassdata ==1)
oldpassdata = passdata;

document.getElementById(oldpassdata).style.backgro undColor='#FFFFFF';

}
// -->
</script>

Jul 23 '05 #2
Use anchors. For each row, have an anchor close to it with a unique
name. You can have something like rown. So for each row, have an anchor
text near to it with name/id = rown. You can then jump to that row by
setting the location property of the bottom frame to the anchor name.
sthg like this in the highlightrow (n) function :
eval ("bottomFrameName.location='row" + n + "'");

Thanks

Anand.

Jul 23 '05 #3
Thank you for that! That sounds like just what I need.

Jul 23 '05 #4
c.**********@gmail.com wrote on 07 mrt 2005 in comp.lang.javascript:
eval ("bottomFrameName.location='row" + n + "'");


why the evil eval?

bottomFrameName.location='row' + n

wouldn't that work?

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #5
Yeah. Thanks

Jul 23 '05 #6
I used the bottomFrame2.locaton='row' + n; and when i do I get
bottomFrame2 is undefined.
I then tried to place the document object before bottomFrame2 and I get

Document.bottomFrame2 is null or not an object error.

Any ideas?

Jul 23 '05 #7
I used document.location='row' + n and I get "The page cannot be found"
error message in the bottom frame.

Jul 23 '05 #8
wrote on 08 mrt 2005 in comp.lang.javascript:
I used the bottomFrame2.locaton='row' + n; and when i do I get
bottomFrame2 is undefined.


[please ALWAYS quote. Usenet is not email, and others want to read too]

bottomFrame2.locaton='row' + n;

locaton ?????????????

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #9
locaton
I misspelled while typing in usernet, "location" is spelled properly in
my code.

Here is the code if it helps.
function highlightrow(n){
clearallrows()
document.getElementById(n).style.backgroundColor=' #FFAABB';
bottomFrame2.location='row' + n;
}

Sorry but I am unfamilar with quoting. I use google (I thought everyone
did) and I can see all related post.

If my [quote] hack from above works I will try to use it more.

Jul 23 '05 #10
you should use #rown. not just rown. using eval works for me fine.

Jul 23 '05 #11
I am using eval and I have put the # in. However I am still getting
bottomFrame2 is undefined.

So I replaced bottomFrame2 with document as the scrip is in the head of
the page that I want to jump around in.
eg
function highlightrow(n){
clearallrows()
document.getElementById(n).style.backgroundColor=' #FFAABB';
eval ("document.location='#row" + n + "'");
}

I don't recieve any errors now however I'm not jumping either.

I have check the code and the anchor tag is there. It is in a table
outside of each row. eg
<a name=row140></a><tr id=140><td>140</td></tr>

Jul 23 '05 #12
Ok progress, It works so long as the anchors are outside of the table.

Problem is the table is generated pragmatically using asp.net. It is
built with a dataset populated with the property information from my
database. I loop through the dataset and create a new row in my table
for each for in the dataset.

I will try to create each row as a single table and put the anchor
after the table (what a hack!) There has to be a better solution.

Jul 23 '05 #13
wrote on 08 mrt 2005 in comp.lang.javascript:
Sorry but I am unfamilar with quoting. I use google (I thought everyone
did) and I can see all related post.


Usenet is over 20 years old, even much older than the web.
No, Google is only used for usenet by a minority.
Most people use a dedicated news-reader.

Read up on Usenet and Usenet netiquette.

<http://www.google.com/search?q=Usenet+netiquette+quoting>
20,600 hits

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #14
JRS: In article <Xn********************@194.109.133.29>, dated Tue, 8
Mar 2005 09:20:23, seen in news:comp.lang.javascript, Evertjan.
<ex**************@interxnl.net> posted :
wrote on 08 mrt 2005 in comp.lang.javascript:
I
[please ALWAYS quote. Usenet is not email, and others want to read too]


I see no point in telling Googlers what to do without telling them how
to do it; be constructive, not just critical.

Keith Thompson wrote :-
If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.

Does new Google now allow indentation?

What's "mrt" ?!?

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME ©
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Jul 23 '05 #15
I guess the script that moves the content in the bottomframe must be
called from the parent page which has this frame object. And the anchor
text now should be the relative path of the "tables" page followed by
the anchor.

Jul 23 '05 #16
c.**********@gmail.com wrote:
I guess the script that moves the content in the bottomframe must be
called from the parent page which has this frame object. And the anchor text now should be the relative path of the "tables" page followed by
the anchor.


The script actually is called with the onload event in the body. There
is a timer that compares two variables. One variable is changed by the
sibling frame. If the two variables are not equal then the row is
highlighted.

So it is all happening in the one page but you are right. I need to
reference the table. If the anchor is in the table it can't be found.

How can I refernce the table in my script?

Here is the code where I reference the anchor:
eval ("document.location='#row" + n + "'");

PS. Thanks for the tip on quoting! Pardon my lack of Usenet netiquette.

Everybody should try google groups beta. (Emphasis on beta) It is a
much improved product. I used Usenet a few years ago when I first found
the net. I would never go back to using it now.

Jul 23 '05 #17
Dr John Stockton wrote on 08 mrt 2005 in comp.lang.javascript:
JRS: In article <Xn********************@194.109.133.29>, dated Tue, 8
Mar 2005 09:20:23, seen in news:comp.lang.javascript, Evertjan.
<ex**************@interxnl.net> posted :
wrote on 08 mrt 2005 in comp.lang.javascript:
I

[please ALWAYS quote. Usenet is not email, and others want to read too]


I see no point in telling Googlers what to do without telling them how
to do it; be constructive, not just critical.


I do see a point, John:

I am being critical, so you can be constructive.

;-}

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #18

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

Similar topics

3
by: Dynamo | last post by:
Hi My site uses frames and some of the frame pages are ranked higher in search engine rankings than the main page. When somebody clicks on the link it takes them to the frame page and they don't...
4
by: Kathryn | last post by:
I hope you can help as this is driving me crazy! I have an asp which has 3 frames on it as follows: <FRAMESET rows="50%,*,10%"> <FRAME src="rundetailstop.asp" name="rundetailstop"...
2
by: Paul | last post by:
I have a simple frame-based application where title information appears in a top frame and a lower frame contains the content for the application. One of the needs for this app is for a status...
3
by: compassSoftware | last post by:
Hi, I have a script that allows me to highlight a row of text. This text is in a table. The table is long and scrolls down the page below the visiable canvas. What I need is a method to...
1
by: Robert Mark Bram | last post by:
Hi All, We are using a scrolling iFrame to present a list of options to the user within the main page with an anchor against each option. Depending on the user actions, we jump to an anchor in...
5
by: Martin Chen | last post by:
I have a frame set (as per MS FrontPage 2000). It has a contents and a main frame. The contents frame has a menu bar written with with javascript (in the context of a table). In IE6.1 everything...
42
by: smerf | last post by:
Using javascript, is there a way to trap an external page inside a frame? I've seen scripts to break out of frames, but nothing to keep a page trapped in a frame.
2
by: mrjoka | last post by:
hi experts, i'm developing a page in ASP but i'm doing also some javascript insode the page. i'm creating a frame and i want to loop this frame with a duplicateloop function so the form will be...
6
by: Richard Maher | last post by:
Hi, Now that I am aware that JS on a page in Frame A can directly call a function on a page in Frame B, I no longer have to continue with my frameB.location.reload() fudge in order to get some...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.