Log in

View Full Version : external links



deep_design
08-11-2005, 12:05 PM
i have a jump menu on my site that contains external links. I need these to load in a new window. At the moment it loads in the same window. Please advice i have included the code below


<select name="menu1" class="feedback" onChange="MM_jumpMenu('parent',this,1)">
<option selected>Distributors</option>
<option value="http://www.fusemusic.com.au/">Australia - Fuse Music</option>
<option value="http://www.lotusrecords.at/">Austria - Lotus Records</option>
<option value="http://munichrecords.com/">Benelux - Munich Records</option>
<option value="http://www.nightday.fr/">France - Night &amp; Day</option>
<option value="http://www.indigo.de/">Germany - Indigo</option>
<option>Greece - Penguin</option>
<option value="http://www.halidon.it/">Italy - Halidon</option>
<option value="http://www.mytrixmusic.com/">Japan - Mytrix</option>
<option>Portugal - Megamusica</option>
<option value="http://www.colectivo.se/">Scandinavia - Colectivo</option>
<option value="http://www.musikvertrieb.ch/home/home.html">Switzerland - Musikvertrieb</option>
<option value="http://www.yenidunya.com/Scripts/Default.asp">Turkey - Yeni Dunya</option>
<option value="http://www.propermusic.com/">UK - Proper</option>
<option value="aboutus.htm">.................................................................</option>
</select>

jscheuer1
08-11-2005, 05:16 PM
Can't tell you exactly without seeing the function:

MM_jumpMenu()but, the solution will probably involve substituting in that function:

window.open(variableHoldingtheURL)for whatever its current navigational statement is.

deep_design
08-11-2005, 05:56 PM
not sure what you mean

i resume this bit needs changing

onChange="MM_jumpMenu('parent',this,1)

jscheuer1
08-11-2005, 06:47 PM
onChange="MM_jumpMenu('parent',this,1)

calls a function. I need to see that function, how it is written.

deep_design
08-12-2005, 08:49 AM
what code do you need to see

do you want me to sedn you the html file

jscheuer1
08-12-2005, 01:29 PM
Search your document and any files linked to it for:

function MM_jumpMenu(

when you find that, get back to me, that and the lines following it are what I need to see. If you don't have that in your file(s):

.

deep_design
08-12-2005, 02:21 PM
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

here is the link www.mostrecords.com/aboutus.htm

jscheuer1
08-13-2005, 01:52 AM
function MM_jumpMenu(targ,selObj,restore){
window.open(selObj.options[selObj.selectedIndex].value)
if (restore) selObj.selectedIndex=0;
}

deep_design
08-13-2005, 10:22 AM
thanks you very much mate.

:)

jscheuer1
04-15-2006, 02:09 AM
Doesn't seem to work for me. The same page link is http://janssenbeauty.com/us/pc/productcompanion.html

The modified/new page window.open is http://janssenbeauty.com/us/pc/productcompaniontest.html

Did a copy paste to avoid making any syntax/typo errors, but no go. No new page, no same page, no error :confused:

Please advise.

It is working here, sort of. Since your files are pdf, they will activate the browser's configured pdf add on (if any and otherwise do whatever the browser is configured to do with pdf and/or unknown file types, which usually is to present the open/save dialogue). Mine is configured to adobe acrobat. So, I get a new window and a launch of acrobat with the pdf displayed once it has downloaded.

JRS
04-17-2006, 07:39 AM
"window.open(this.href,'null','width=800,height=600,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');return false" is the desired format for the external link. What is the syntax required to incorporate it in
window.open(selObj.options[selObj.selectedIndex].value) ?

jscheuer1
04-17-2006, 08:15 AM
"window.open(this.href,'null','width=800,height=600,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');return false" is the desired format for the external link. What is the syntax required to incorporate it in
window.open(selObj.options[selObj.selectedIndex].value) ?

Note: 'null' in the above is technically incorrect to begin with. It occupies the place for the window name and since it is quoted, it is a literal. However, null is a reserved word, it should be either null with no quotes or an actual name for the window. Alternatively, it could be empty quotes.

Assuming that the second code block you have there is not itself enclosed in quotes of any kind and selObj is a valid select element whose valid option's values are valid urls:


window.open(selObj.options[selObj.selectedIndex].value,null,'width=800,height=600,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');

Quotes around the window.open() method are only required in situations like where it is assigned to an event like an onclick event. The 'return false;' only needs to be used in situations (once again like onclick) where the browser would ordinarily do something else, like open the page in the present window.

In addition to the width, height and chrome of the new window, you can also specify its top and left position.

The window.open method has three main parts:

window.open(location, name, settings)

Any of these may be literals if quoted or variables or reserved objects if not. You do not need to specify any settings but, once you specify any, the default applies for all others, usually this is 'no'.

JRS
04-17-2006, 08:46 PM
the combination of double quotes, single quotes, variables, literals, and reserved words is too much for my syntactically challenged brain.

You were right. my reference was actually onclick="window.open ...

Didn't mean to be misleading; but, was looking at the implementation of window.open in three different scenarios (onclick and selobj and general) and mixed and matched them at 339AM <sigh>

The objective is to have one page act as a menu that opens a boatload of PDFs, so obviously it had to be a separate window so as not to lose the menu.

Since Adobe Acrobat Reader is a full blown application and a web browser is a full blown application, when opening a PDF inside of a web browser, the visitor is confronted with an application within an application which can be unnecessarily confusing. Additionally, the browser bars use up a lot of real estate of the PDF and offer no additional function, making less content available for the viewer.

Your explanation was helpful and your example - right on point; but, more importantly ... the speed of the response.

thanx:)

Can you point me to a good tutorial on window.open ?

mwinter
04-18-2006, 09:46 AM
'width=800,height=600,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes'This feature string can be greatly reduced to:



'width=800,height=600,status,scrollbars,resizable'
As you later mention,


You do not need to specify any settings but, once you specify any, the default applies for all others, usually this is 'no'.though, to be accurate, the default value for boolean attributes is usually 'no' (titlebar, and perhaps one or two others, defaults to 'yes').

Mike

jscheuer1
04-18-2006, 04:52 PM
Can you point me to a good tutorial on window.open ?

The window.open() method is complex, to say the least. Here is a fairly good tutorial:

http://www.w3schools.com/htmldom/met_win_open.asp

My only objections to it are that:

1) It mentions a number of IE only options/settings as well as the usual cross-browser ones without identifying which are which. (I assume this is because the IE specific ones will degrade well in other browsers but I'm not certain of this - testing of any code, even simple HTML, should always be done in all target browsers anyway.)

2) The description of the use of the name field leaves out the fact that a unique name may be used and what doing so can accomplish.

However, there are so many possible configurations (not to mention its use with other coding conventions) for this method that any tutorial is likely to leave out some of the subtle variations/tricks/combinations that can be employed.

jscheuer1
04-19-2006, 01:04 PM
Oops. Forgot to mention where the requirement came from. The objective was to have one page act as a menu that opened a boatload of PDFs, so obviously it had to be a separate window so as not to lose the menu.

Since Adobe Acrobat Reader is a full blown application and a web browser is a full blown application, when opening a PDF inside of a web browser, the visitor is confronted with an application within an application which can be unnecessarily confusing. Additionally, the browser bars use up a lot of real estate of the PDF and offer no additional function, making less content available for the viewer.

And your question is now answered to your satisfaction or not?

JRS
04-20-2006, 03:31 AM
Yes, definitely.

Just realized that my request was not connected to a requirement. No doubt other people will have a similar Acrobat Reader PDF requirement so now if they search on Acrobat Reader or PDF, this thread will come up :)

Probably should have done an edit rather than a post <sigh>