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

using popupmenu, and passing the target frame's ID when clicked.Can I do this?

J
Hi,

I'm using the following code snippet to show popup menus (in a header
frame) and target the menu options to another frame. This works fine for
a single hard-coded frame (e.g. "2" below, in doClick) but I need to
pass in the target frame ID when the user clicks, the reason being that
different options will target different frames depending on who the user is.

the target frame name is in the target attribute of the link tag, i.e.
<a href="" target="here"> that the user clicks on but I don't know how
to make use of this in the code below.

Hope that makes sense, can anyone help?

J
function showMenu(linkObj, menuID)
{
var popupObj = window.createPopup();
var popupBodyObj = popupObj.document.body;
popupBodyObj.style.border = "0px black solid";
popupBodyObj.style.color="99ccff";
popupBodyObj.style.hover="red";
popupBodyObj.innerHTML = menuID.outerHTML;
for (var i = 0; i < popupBodyObj.all.length; i++)
{
if (popupBodyObj.all[i].tagName == "A")
popupBodyObj.all[i].onclick = doClick;
}
popupObj.show(0, linkObj.offsetHeight+2, menuID.offsetWidth,
menuID.offsetHeight, linkObj);

}
function doClick()
{
parent.frames(2).location = this.href;
return false;
}
Jul 23 '05 #1
5 1480
J wrote:
<snip>
function doClick()
{
parent.frames(2).location = this.href;
return false;
}


In any context where - this.href - can be used to reference the HREF of
a link - this.target - can be used to reference its TARGET attribute's
value.

(Incidentally, code posted to newsgroups should be formally block
indented, preferably with 2-4 space characters, if you want people to
read the code. The FAQ covers the details.)

Richard.
Jul 23 '05 #2
Richard Cornford wrote:
J wrote:
<snip>
function doClick()
{
parent.frames(2).location = this.href;
return false;
}

In any context where - this.href - can be used to reference the HREF of
a link - this.target - can be used to reference its TARGET attribute's
value.


But "this.href" in that function doesn't refer to the links href
property, it is attempting to refer to the functions href property.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #3
Randy Webb wrote:
<snip>
But "this.href" in that function doesn't refer to the
links href property, it is attempting to refer to the
functions href property.


You don't expect me to actually read code that has not been presented in
a properly indented form to the extent of understanding what - this -
may refer to in any context, do you? ;)

Richard.
Jul 23 '05 #4
Richard Cornford wrote:
Randy Webb wrote:
<snip>
But "this.href" in that function doesn't refer to the
links href property, it is attempting to refer to the
functions href property.

You don't expect me to actually read code that has not been presented in
a properly indented form to the extent of understanding what - this -
may refer to in any context, do you? ;)


You have a point ;)

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #5
J wrote:
[...]
popupBodyObj.innerHTML = menuID.outerHTML;
for (var i = 0; i < popupBodyObj.all.length; i++)
{
if (popupBodyObj.all[i].tagName == "A")
popupBodyObj.all[i].onclick = doClick;
}


This snippet (and likely others) makes your code IE only. Is
that your intention? If not, other methods can be used that
allow non-IE browsers to use your page.

--
Fred
Jul 23 '05 #6

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

Similar topics

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"...
0
by: MooMaster | last post by:
This is more of a wxPython centric question, but not seeing reference to this on the wx group I thought I'd try here since many here also use wxPython toolkit. I started learning GUI development...
2
by: RWD | last post by:
I am trying to figure out how to change the target frame in my hyperlink on a DHTML menu. The menu is in one frame and the target frame is called "main" The code is below: Thanks in advance...
3
by: Justnew | last post by:
I have a web application and a frameset. The fameset have left and righ frame. What I want to archieve is that when I click on a button on th left frame I want the link that is placed on the button...
3
by: Evan | last post by:
I have a web page with 2 frames. The left frame is running menu.aspx and the right frame is running images.aspx. When a selection is made in menu.aspx I call a method in images.aspx and pass a...
16
by: Giggle Girl | last post by:
Hi there, I have a nav tree similar to the XP Windows Explorer in behavior. It uses styles to underline a row on mouseover, and change the look of a row when clicked. Currently, it is working...
0
by: celoftis | last post by:
Using VS2005, VB code behind, BACKGROUND I'm trying to set up a page with a TreeView of links on the left hand side of my page - when clicked I want the links to open in the remaining portion...
13
by: sindhu | last post by:
Hello acoder. I want to know another type of passing values between pages I have three frames frame1 for main horizontal menu frame 2 for vertical submenu frame 3 which is is loaded based on...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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...
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...

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.