Click to See Complete Forum and Search --> : opening this in a NEW WIndow: menu1.addItem("MENU ITEM", "LINK.HTML");


leo_bassani
09-23-2003, 06:16 PM
Does anyone know how to pen the Javascript link on this line of code in a NEW window?

menu1.addItem("MENU ITEM", "LINK.HTML");

But this code is present inside a .JS file which builds a menu. The links are not present in the HTML file, but in the .JS file.

It does not look like it works like a normal external javascript with the window.open etc

Beginner alert..... :confused:


Thanks much.

Leonardo!

ColdSteel
09-23-2003, 06:26 PM
here's some code:


<HTML>
>Head>
<Script Language=Javascript Type="Text/Javascript">

<-- Hide script from older browsers

function newWindow() {

catWIndow = window.open('whatever.html', 'catWin')

}

// End hiding the script -->
</Head>
<Body>
<A Href="javascript:newWindow()"> the text </A>
</Body>
</HTML>

Just insert your info into the obvious places....hope this helps....

leo_bassani
09-23-2003, 06:45 PM
Thanks,


But the code and links are present inside a .JS file which builds a menu. The links are not present in the HTML file itself. The menu links are loaded from this .JS file.

THe file is called menucontent and what I need to do is open the "resume.doc" file in a new window.

// menu : #2
var menu2 = ms.addMenu(document.getElementById("menu2"));
menu2.addItem("Download Resume, Word Format", "doc/resume.doc");
menu2.addItem("Download Resume, PDF Format", "doc/resume.pdf");
menu2.addItem("Download Resume, HTML Format", "doc/resume.html");

Thanks for thge help!

Leonardo

ColdSteel
09-24-2003, 12:05 PM
If the document file is on the host in like a .doc filename you should be able to pull it directly from the host I think...kinda like pulling an image direct from the host....same thing with a .js file...hope this helps...I'm not exactly an "expert" with Javascript...just a JS user....

ColdSteel
09-24-2003, 12:18 PM
Hey, I should have paid more attention to your question...if the code that I gave doesnot work I am not entirely sure how to do what you want exactly....

MWMooney
05-26-2006, 02:47 PM
I had a similiar issue with a menu type maker
I used this type of syntax and it worked for me.
menu1.addItem("MENU ITEM", "javascript:window.open('LINK.HTML')");

It may not fit in your setup but a suggestion to try at least.