Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a function from within a function 1

Status
Not open for further replies.

rocknrisk

Programmer
May 14, 2002
43
GB
Hi all,

Help please.

I need to be able to call a function from within a function. Basically, I have a JavaScript menu, and I want one of the menu items to call a function that opens a special window (that will have a Web page inside).

So far I have this:

In "menu.js" I have the line:
menu[0][2] = new Item(' Page in Special Window', 'pageinspecialwindow.html', '_new', 60, 10, 0);

In the main web page I could add a link (to open the special button) like this:
<p><a href=&quot;#&quot; onclick=&quot;mywin002=openFunction('pageinspecialwindow.html',550,600,null,null,'mywin002',5,false,false,true,'#FF8000','#FFC184');return false&quot;>Open Page In Special Window</a>

How do I call the function that is called by onclick in the menu item. I really hope this question makes sense.

I would appreciate any help. [smile] &quot;The important thing is not to stop questioning.&quot; - Albert Einstein
 
OK, if I'm understanding you correctly, you need to do something like this.


menu:
<a href=&quot;#&quot; onclick=&quot;openwindow();&quot;>Open Page In Special Window</a>

function to go in head section of html page:
function openwindow(){
var child = window.open('pageinspecialwindow.html',550,600,null,null,'mywin002',5,false,false,true,'#FF8000','#FFC184')
}


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top