473,386 Members | 1,842 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,386 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 1615
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.