Home
Products
Downloads
Support
Buy
How do I target a new Window or Frame when a user clicks on an Item?
Product Name: WebMenu for PHP
Product Version: 7.0
Document Type: Question
Last Updated: 9/5/2016
Document ID: 47
Answer

WebMenu does not use <A> tags for hyperlinks, so there is no property that reflects the TARGET attribute. Instead, WebMenu performs its navigation by using client-side JavaScript, namely the location.href property.

To provide the most flexibility to the page developer, the WebMenu Item object has an OnClick property. Use this property to provide client-side JavaScript code to execute when the Item is clicked. Use of this property overrides any value present in the URL property also available on the Item object.

To open a new window:

objItem->setOnClick("window.open('http://www.domain.com/page', 'WindowName');");

To target a specific frame:

objItem->setOnClick("top.{framename}.location.href = 'http://www.domain.com/page';");

Note that {framename} is the NAME attribute of the <FRAME> tag provided in the FRAMESET document that you created. This value may be case-sensitive.

Copyright © 2024 Coalesys, Inc. All Rights Reserved.