Using an onClick function withtin the aI

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
jester626
Beginner
Beginner
Posts: 1
Joined: Thu Oct 04, 2007 3:50 pm

Using an onClick function withtin the aI

Post by jester626 »

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
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Re: Using an onClick function withtin the aI

Post by Ruth »

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: Select all

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'); 
} 
Then in the aI string you'd have this

Code: Select all

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
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Re: Using an onClick function withtin the aI

Post by Ruth »

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
Post Reply