473,597 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

anchors

Hi,

I have a topframe and a mainframe.

The topframe contains a listbox with trucknumbers (non sequential).
The mainframe contains a page, where each truck has a table with data.
In the topleft cell of each table I put a named link <a name=$trucknumb er>.
Tables are generated using php.

I want to use an onChange event in the listbox to jump to the corresponding
anchor in the mainframe. The function below doesn't work.

function jump(anker){
parent.frames['main'].href="#"+paren t.frames['main'].links[anker].value;
}

any suggestions ?
thx

Ward
Jul 20 '05 #1
8 1625
Ivo
"Ward" <ki************ @for.president. com> wrote in message
news:Xn******** *************** ***********@195 .130.132.70...
<snip>
function jump(anker){
parent.frames['main'].href="#"+paren t.frames['main'].links[anker].value;
}
Have you also tried the variant with "location." just before "href." ?
HTH
Ivo
any suggestions ?
thx

Ward

Jul 20 '05 #2
Lee
Ward said:

Hi,

I have a topframe and a mainframe.

The topframe contains a listbox with trucknumbers (non sequential).
The mainframe contains a page, where each truck has a table with data.
In the topleft cell of each table I put a named link <a name=$trucknumb er>.
Tables are generated using php.

I want to use an onChange event in the listbox to jump to the corresponding
anchor in the mainframe. The function below doesn't work.

function jump(anker){
parent.frame s['main'].href="#"+paren t.frames['main'].links[anker].value;


parent.frames['main'].location.hash= "#"+truckNumber ;

Jul 20 '05 #3
On Tue, 24 Feb 2004 13:57:47 GMT, Ward <ki************ @for.president. com>
wrote:
The topframe contains a listbox with trucknumbers (non sequential).
The mainframe contains a page, where each truck has a table with data.
In the topleft cell of each table I put a named link
<a name=$trucknumb er>.
New webpages should target sections within documents using the id
attribute instead of using A elements as anchors. So, in place of:

<table>
<tr>
<td><a name="frag-identifier"></a>
...

you might use:

<table>
<tr id="frag-identifier">
<td>
...
I want to use an onChange event in the listbox to jump to the
corresponding anchor in the mainframe. The function below
doesn't work.

function jump(anker){
parent.frames['main'].href="#"+paren t.frames['main'].links[anker].value;
}

any suggestions ?


1) Window objects, and therefore frames, do not have a href property.
2) ...nor do they have a links property.
3) Knowing what 'anker' is would be helpful.

The approach you have presented seems likely to fail in all browsers. Even
after correcting the l-value to use location, not href, it will still fail
in most browsers.

A simpler solution would be:

function changePage( linkList ) {
var fragment = linkList.option s[ linkList.select edValue ].value;

// Check that the option does contain a fragment identifier
// This allows for options such as "Choose section" which should
// have no destination
if( fragment ) parent.frames['main'].location = '#' + fragment;
}
...
<select onchange="chang ePage(this)">
<option value="">Choose section</option>
<option value="Section-1">Section 1</option>
<option value="Section-2">Section 2</option>
...
</select>

Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #4
Michael Winter <M.******@bluey onder.co.invali d> wrote in
news:op******** ******@news-text.blueyonder .co.uk:
On Tue, 24 Feb 2004 13:57:47 GMT, Ward
<ki************ @for.president. com> wrote:
The topframe contains a listbox with trucknumbers (non sequential).
The mainframe contains a page, where each truck has a table with
data. In the topleft cell of each table I put a named link
<a name=$trucknumb er>.


New webpages should target sections within documents using the id
attribute instead of using A elements as anchors. So, in place of:

<table>
<tr>
<td><a name="frag-identifier"></a>
...

you might use:

<table>
<tr id="frag-identifier">
<td>
...
I want to use an onChange event in the listbox to jump to the
corresponding anchor in the mainframe. The function below
doesn't work.

function jump(anker){
parent.frames['main'].href="#"+paren t.frames['main'].links[anker].valu
e; }

any suggestions ?


1) Window objects, and therefore frames, do not have a href property.
2) ...nor do they have a links property.
3) Knowing what 'anker' is would be helpful.

The approach you have presented seems likely to fail in all browsers.
Even after correcting the l-value to use location, not href, it will
still fail in most browsers.

A simpler solution would be:

function changePage( linkList ) {
var fragment = linkList.option s[ linkList.select edValue ].value;

// Check that the option does contain a fragment identifier
// This allows for options such as "Choose section" which should
// have no destination
if( fragment ) parent.frames['main'].location = '#' + fragment;
}
...
<select onchange="chang ePage(this)">
<option value="">Choose section</option>
<option value="Section-1">Section 1</option>
<option value="Section-2">Section 2</option>
...
</select>

Mike


If you change selectedValue to selectedIndex your example does indeed
work.

thx for your help

Ward
Jul 20 '05 #5
On Tue, 24 Feb 2004 21:45:02 GMT, Ward Germonpé
<ki**********@f orpresident.com > wrote:
Michael Winter <M.******@bluey onder.co.invali d> wrote in
news:op******** ******@news-text.blueyonder .co.uk:
[snip]
function changePage( linkList ) {
var fragment = linkList.option s[ linkList.select edValue ].value;


[snip]
If you change selectedValue to selectedIndex your example does indeed
work.


Sorry. :) Lapse in concentration.

Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #6
Michael Winter <M.******@bluey onder.co.invali d> wrote in
news:op******** ******@news-text.blueyonder .co.uk:
On Tue, 24 Feb 2004 21:45:02 GMT, Ward Germonpé
<ki**********@ forpresident.co m> wrote:
Michael Winter <M.******@bluey onder.co.invali d> wrote in
news:op******** ******@news-text.blueyonder .co.uk:


[snip]
function changePage( linkList ) {
var fragment = linkList.option s[ linkList.select edValue ].value;


[snip]
If you change selectedValue to selectedIndex your example does indeed
work.


Sorry. :) Lapse in concentration.

Mike


I'm not quite there yet...

I had to change the code as follows to prevent the topframe from loading
into the mainframe.

if (fragment) parent.frames['main'].location = parent.frames
['main'].location + '#' + fragment;

Now it works, but only once.

There are no errors in the javascript console.
thx

Ward
Jul 20 '05 #7
On Wed, 25 Feb 2004 10:18:27 GMT, Ward <ki************ @for.president. com>
wrote:
Michael Winter <M.******@bluey onder.co.invali d> wrote in
news:op******** ******@news-text.blueyonder .co.uk:
On Tue, 24 Feb 2004 21:45:02 GMT, Ward Germonp
<ki**********@f orpresident.com > wrote:
[snip]
If you change selectedValue to selectedIndex your example does indeed
work.


Sorry. :) Lapse in concentration.


I'm not quite there yet...

I had to change the code as follows to prevent the topframe from loading
into the mainframe.

if (fragment) parent.frames['main'].location = parent.frames
['main'].location + '#' + fragment;

Now it works, but only once.

There are no errors in the javascript console.


That is because a second usage will append, not replace, the first
fragment identifier. That is,

index.html -> index.html#Sect ion-1 -> index.html#Sect ion-1#Section-2

Lee's use of Location.hash should fix this:

if (fragment) parent.frames['main'].location.hash = '#' +
fragment;

Hopefully, that should be it.

Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #8
Michael Winter <M.******@bluey onder.co.invali d> wrote in
news:op******** ******@news-text.blueyonder .co.uk:
On Wed, 25 Feb 2004 10:18:27 GMT, Ward
<ki************ @for.president. com> wrote:
Michael Winter <M.******@bluey onder.co.invali d> wrote in
news:op******** ******@news-text.blueyonder .co.uk:
On Tue, 24 Feb 2004 21:45:02 GMT, Ward Germonp
<ki**********@f orpresident.com > wrote:
[snip]
If you change selectedValue to selectedIndex your example does
indeed work.

Sorry. :) Lapse in concentration.


I'm not quite there yet...

I had to change the code as follows to prevent the topframe from
loading into the mainframe.

if (fragment) parent.frames['main'].location = parent.frames
['main'].location + '#' + fragment;

Now it works, but only once.

There are no errors in the javascript console.


That is because a second usage will append, not replace, the first
fragment identifier. That is,

index.html -> index.html#Sect ion-1 ->
index.html#Sect ion-1#Section-2

Lee's use of Location.hash should fix this:

if (fragment) parent.frames['main'].location.hash = '#' +
fragment;

Hopefully, that should be it.

Mike


It works !

thx a lot

Ward
Jul 20 '05 #9

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

Similar topics

7
2319
by: Ben Wilson | last post by:
To anyone who can help me, you have my thanks in advance. I am implementing a "301 Moved Permanently" redirect in my website due to a change of our domain names. Unfortunately, I am having a problem with reconstructing the target "Location" http header because I'm missing just one thing. My links look as follows: http://www.oldurl.com/beanie.php#three?register=false&demt=43
1
1281
by: Peter Jakobi | last post by:
Hello, I want to place two lines relative to another. The problem is, that these two lines are in different groups. Is there an possibility to set the x and y values of the second line with the values of the first line + an offset. Something like that for example:
2
1614
by: mlv2312 | last post by:
Hi, I have experienced problems when dealing with nested anchors. I implemented some code to perform highlighting and specific anchors are used for the searched words. The problem is when the searched words are inside <a href> tags, the links are lost after putting my anchors. For example: <a class="Programa" href="#" OnClick="window.open('/something.tif');"
1
2026
by: mlv2312 | last post by:
Hi, I have experienced problems when dealing with nested anchors. I implemented some code to perform highlighting and specific anchors are used for the searched words. The problem is when the searched words are inside <a href> tags, the links are lost after putting my anchors. For example: <a class="Programa" href="#" OnClick="window.open('/something.tif');"
2
1883
by: learner | last post by:
Hi, A document has many Anchors. I want to take a particular action only if some particular anchors are clicked. I mean if some anchors are clicked, i want an alert box to pop up with ok and cancel. and if ok is clicked i have to view that link, if cancel, then it should not open that link. How to do this?
21
2451
by: adrian suri | last post by:
Hi just started to experement with styleshhets, and have defined hover a:hover { Color : red; Text-decoration : none; Border-top-width : medium; Border-right-width : medium;
12
2360
by: Rich | last post by:
Strangely, on-page anchors will work on MSIE, but not on Netscape7.2 or Firefox1.5. All anchors are numbers e.g. <a href="#21">TOPIC</a> supposed to connect down to <a name="#21>beginning of text</a> . Could be further complicated by the ASP and SQL designation of URL. like: http://sampleURL.org/FAQs.asp?FAQMID=11&NumFaq=10&bmode=Main W3C validator said 91 errors, mostly on tables, fonts and graphics, but didn't seem to complain about...
17
4280
by: Crimperman | last post by:
Hi, need some advice on URIs In a dynamic page (perl driven) we list a number of items presented in an hierarchical tree structure. Within that page is a form which allows you to search for items containing various strings (trying to get the users to *remember* CTRL+F was proving fruitless). The results are then presented at the top of the page with links to the relative anchor references (<a href="#foo">) . When clicked these would...
1
2465
by: Alec MacLean | last post by:
Hi. I'm using VS2005 Pro to work on a website project for my company. The site has several navigation elements, all based on the standard VS2005 navigation components. I have high-level section navigation provided via a horizontal menu, a SiteMapPath to provide a breadcrumb and a vertical menu component on the left edge.
3
16542
by: windandwaves | last post by:
does it matter if I write var anchors = document.getElementsByTagName("A"); or var anchors = document.getElementsByTagName("a"); Or is there a better way to catch both <a hrefs and <A HREFS
0
7969
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
8272
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...
1
8035
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6688
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
5847
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
5431
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3886
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
2404
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
0
1238
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.