Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:28
Using an onClick function withtin the aI
Poster: jester626
Dated: Thursday October 4 2007 - 16:16:29 BST
I have scoured the forums and have found many references for the onClick Function. However none of the answers helps me (or at least I don't fully understand)
Basically here is what I have:
<a href="#" onClick="mainwin.load('iframe', 'testpage.php', 'A Test Page'); return false">Goto Test Page</a>
This is referencing the following variable:
var mainwin=dhtmlwindow.open("MainWindow", "iframe", "welcome.php", "Welcome", "width=800px,height=600px,resize=1,scrolling=1,left=187px", "recal")
I need to know what syntax with in the aI to use.
Thanks in advance
Jester
Re: Using an onClick function withtin the aI
Poster: Ruth
Dated: Saturday October 6 2007 - 5:58:03 BST
Hi,
Well, you have reach another person who does very little with js, and I sure don't create it. However, I can give you an example and how it's set up and then you would have to set yours up. First you have the function. Then in the data file you put the function at the top after the openDelay section before the style. Then in the aI you would call the function, so in this case the that would be in the url section. url=javascript:function call here. So, as an example here's a function to open a new window of a certain size, in a certain position with certain parameters. In the data file you'd see this at the top.
Code:
fixMozillaZIndex=true; //Fixes Z-Index problem with Mozilla browsers but causes odd scrolling problem, toggle to see if it helps
_menuCloseDelay=500;
_menuOpenDelay=150;
_subOffsetTop=2;
_subOffsetLeft=-2;
var newwindow;
function poptastic(url)
{
newwindow=window.open(url,'name','height=500,width=400,left=100,
top=100,resizable=yes,scrollbars=yes,toolbar=yes,status=yes');
}
_menuCloseDelay=500;
_menuOpenDelay=150;
_subOffsetTop=2;
_subOffsetLeft=-2;
var newwindow;
function poptastic(url)
{
newwindow=window.open(url,'name','height=500,width=400,left=100,
top=100,resizable=yes,scrollbars=yes,toolbar=yes,status=yes');
}
Then in the aI string you'd have this
Code:
aI("text=item;url=javascript:poptastic('http://whatever/');");
Since the code is set in the url section you do not need the onclick since that is how a link works in the url section by default.
I would play around with what you have but I actually need html pages that are done with that link on it to test things and see what I can get to work. For example it is saying main window load iframe and the page to load so does the main window/page have an iframe on it? If you can give me the page with the working function I can see if I can get it to work in the menu.
Ruth
Re: Using an onClick function withtin the aI
Poster: Ruth
Dated: Thursday October 11 2007 - 8:04:20 BST
Hi,
I found one other post about opening a new window with a page with iframes and having the iframes loaded. Not sure if this will give you some ideas for what you need.
viewtopic.php?f=10&t=8628&hilit=iframe+load+iframe
Ruth