-
Script controling dropdown, loading link in 2nd window
I have a JavaScript which processes the contents/selection of a dropdown box,
loading the associated URL or page.
This works fine.
However what I want is for the URL/Page to load in the main window/frame
(not a new window but one already on screen) and not the current, contents
one.
I have tried using target in various ways with no success.
Pardon any 'dullness', it's my first ever venture into JavaScript
Example of Script is.
<SCRIPT>
/* comments in JavaScript here */
function change_site()
{var
site=document.myform.mypopup.selectedIndex;
if (confirm('Are you sure you want to change site? ' + site))
{if (site==1) {
window.location.href=document.myform.mypopup.options[site].text; }
else {
window.location.href=document.myform.mypopup.options[site].value;} }
}
</SCRIPT>
-
Re: Script controling dropdown, loading link in 2nd window
See the window.open() function. You can direct the response to a new window,
or to any named window. If the named window doesn't exist, the function
opens it. If the named window already exists, it causes that window to
request the specified URL.
"Perry Garrod" <perrygarrod@hotmail.com> wrote in message
news:3e27d164$1@tnews.web.devx.com...
>
> I have a JavaScript which processes the contents/selection of a dropdown
box,
> loading the associated URL or page.
>
> This works fine.
>
> However what I want is for the URL/Page to load in the main window/frame
> (not a new window but one already on screen) and not the current, contents
> one.
>
> I have tried using target in various ways with no success.
>
> Pardon any 'dullness', it's my first ever venture into JavaScript
>
> Example of Script is.
> <SCRIPT>
> /* comments in JavaScript here */
> function change_site()
> {var
> site=document.myform.mypopup.selectedIndex;
> if (confirm('Are you sure you want to change site? ' + site))
> {if (site==1) {
> window.location.href=document.myform.mypopup.options[site].text; }
> else {
> window.location.href=document.myform.mypopup.options[site].value;} }
> }
> </SCRIPT>
>
-
Re: Script controling dropdown, loading link in 2nd window
"Russell Jones" <arj1@nospam.northstate.net> wrote:
>See the window.open() function. You can direct the response to a new window,
>or to any named window. If the named window doesn't exist, the function
>opens it. If the named window already exists, it causes that window to
>request the specified URL.
>
>"Perry Garrod" <perrygarrod@hotmail.com> wrote in message
>news:3e27d164$1@tnews.web.devx.com...
>>
>> I have a JavaScript which processes the contents/selection of a dropdown
>box,
>> loading the associated URL or page.
>>
>> This works fine.
>>
>> However what I want is for the URL/Page to load in the main window/frame
>> (not a new window but one already on screen) and not the current, contents
>> one.
>>
>> I have tried using target in various ways with no success.
>>
>> Pardon any 'dullness', it's my first ever venture into JavaScript
>>
>> Example of Script is.
>> <SCRIPT>
>> /* comments in JavaScript here */
>> function change_site()
>> {var
>> site=document.myform.mypopup.selectedIndex;
>> if (confirm('Are you sure you want to change site? ' + site))
>> {if (site==1) {
>> window.location.href=document.myform.mypopup.options[site].text; }
>> else {
>> window.location.href=document.myform.mypopup.options[site].value;} }
>> }
>> </SCRIPT>
>>
>
>
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks