Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 1st, 2006, 02:56 PM
jxn jxn is offline
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default showing javascript context menus outside frames...

I seem to be having problems displaying context menus outside of framed sections... right now I've got a sort of sidebar in an iframe, with a bunch of links, each of which display large context menu (an iframe in itself) onclick. However, the context menu is confined to the iframe, forcing the bulk of its information to remain hidden. Is there anyway I can get this popup context menu to display in the main frame, outside of the iframe? Thanks.

Reply With Quote
  #2 (permalink)  
Old February 2nd, 2006, 09:55 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

You could adjust you code to add the context menu to the parent window that contains your iframe, maybe using parent.document for instance rather than document

HTH,

Chris

Reply With Quote
  #3 (permalink)  
Old February 2nd, 2006, 01:51 PM
jxn jxn is offline
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

excellent! I'd attempted this, but I apparently made a typo and omitted the "document" from "parent.document". It's working great now, other than the fact that when the menu is called open now, iframe seems to reload, scrolling back up to position zero... Is there a simple way to stop it from doing that?

I'm setting the position onClick using the style top and left elements at the values of event.clientX and event.ClientY when the mouse clicks the link to open the context menu from within the iframe, if that helps (or is understandable, for that matter).

thanks.
Reply With Quote
  #4 (permalink)  
Old February 3rd, 2006, 04:51 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Can you post the html for the link that you are clicking please?

Cheers,

Chris

Reply With Quote
  #5 (permalink)  
Old February 3rd, 2006, 10:43 AM
jxn jxn is offline
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sure...

Code:
<a href="" onclick="var targetDiv = parent.document.getElementById('iframeContext'); targetDiv.style.top = event.clientY + 'px'; targetDiv.style.left = event.clientX + 'px'; targetDiv.style.position = 'absolute'; targetDiv.className = 'albumContext'; targetDiv.src = './widgets/albumInfoContext.php?cdid=<?=$s[cddbid]?>'; "><?php echo($s[artist])?></a>
Reply With Quote
  #6 (permalink)  
Old February 3rd, 2006, 07:53 PM
jxn jxn is offline
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

oops; on further inspection, I am an idiot. the href="" focuses the page at the top, duh.

thanks, though.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Showing three frames in a single url click artarasan Classic ASP Basics 0 November 30th, 2007 06:52 AM
refreshing frames with javascript arnabghosh Javascript How-To 1 April 18th, 2006 07:14 AM
javascript and frames ihatejava Javascript How-To 1 January 25th, 2006 02:28 AM
Javascript menus alancdude Javascript 5 November 26th, 2003 11:58 AM
frames and pop-up menus like oil and water? bee Dreamweaver (all versions) 1 October 26th, 2003 02:58 PM



All times are GMT -4. The time now is 10:13 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.