Opening a document using javascript

This is a discussion on "Opening a document using javascript" within the Starting Out section. This forum, and the thread "Opening a document using javascript are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Starting Out

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Sep 14th, 2007, 14:37
New Member
Join Date: Sep 2007
Location: UK
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Opening a document using javascript

I would like to open a new page using javascript. I have found a way to open a document in a new browser window but I would like to open the document in the current browser window instead.

Here is what I was using to open the document in a new browser:

open("page_name")

But is there a argument I can add to open the page in the current browser window?

Thanks in advance for your help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Sep 14th, 2007, 14:46
Most Reputable Member
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Opening a document using javascript

Why do you want to do this? Will your users thank you for taking control of their browser?

What's wrong with a simple link? <a href="somePage.html">Some page</a>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Sep 14th, 2007, 14:52
New Member
Join Date: Sep 2007
Location: UK
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Opening a document using javascript

Because I want to trigger the page load using the onmouseover event. Couldn't work out how to use A HREF with onmouseover=""

All I actually want to do is display a couple of menu options below a button when the user places their mouse over a particular button.

I'm sure there is a better way to do it if you can point me in the right direction.

btw: I have since found out that this works:

window.location.href="page_name"

but I would still like a neater solution if you have one.

Last edited by gentlefoot; Sep 14th, 2007 at 15:14.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Sep 14th, 2007, 16:25
Most Reputable Member
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Opening a document using javascript

Quote:
Originally Posted by gentlefoot View Post
Because I want to trigger the page load using the onmouseover event. Couldn't work out how to use A HREF with onmouseover=""

All I actually want to do is display a couple of menu options below a button when the user places their mouse over a particular button.

I'm sure there is a better way to do it if you can point me in the right direction.

btw: I have since found out that this works:

window.location.href="page_name"

but I would still like a neater solution if you have one.
Okay, let me get this straight: you want some kind of drop-down menu, and you're prepared to load a completely new page just to achieve that? Not exactly a "seamless user experience", is it?

There are lots of alternatives. Look into CSS or javascript drop-down menus. For example: http://css.maxdesign.com.au/listamatic/

More abstractly, you can always have javascript create an absolutely positioned <div> (for your menu options) onmouseover, and then destroy it onmouseout. http://www.javascripttoolbox.com/lib/popup/example.php To make it stick positioned by your menu, just make some part of the menu box relatively positioned, and put the absolute <div> inside.

Last edited by MikeHopley; Sep 14th, 2007 at 16:30.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Sep 15th, 2007, 12:18
New Member
Join Date: Sep 2007
Location: UK
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Opening a document using javascript

Quote:
Originally Posted by MikeHopley View Post
Okay, let me get this straight: you want some kind of drop-down menu, and you're prepared to load a completely new page just to achieve that? Not exactly a "seamless user experience", is it?

There are lots of alternatives. Look into CSS or javascript drop-down menus. For example: http://css.maxdesign.com.au/listamatic/

More abstractly, you can always have javascript create an absolutely positioned <div> (for your menu options) onmouseover, and then destroy it onmouseout. http://www.javascripttoolbox.com/lib/popup/example.php To make it stick positioned by your menu, just make some part of the menu box relatively positioned, and put the absolute <div> inside.
Exactly. I don't want to reload a whole page but I just needed a quick solution for a prototype.

Thanks for the help. I will check out those links. I figured you could do it like this but just couldn't find any good reference info and examples.

Thanks again.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Sep 16th, 2007, 21:10
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: Opening a document using javascript

Quote:
Originally Posted by gentlefoot View Post
Because I want to trigger the page load using the onmouseover event. Couldn't work out how to use A HREF with onmouseover=""

All I actually want to do is display a couple of menu options below a button when the user places their mouse over a particular button.

I'm sure there is a better way to do it if you can point me in the right direction.

btw: I have since found out that this works:

window.location.href="page_name"

but I would still like a neater solution if you have one.
Neater? I don't quite get you there.
if you want open a new page that is the code you use,
how would anything be neater?
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Asp not opening! aspcam Classic ASP 2 Jul 26th, 2007 22:38
document.getElementById and document.getElementByName is not working in FF dhineraj JavaScript Forum 3 Jul 26th, 2007 20:23
How do I stop this javascript document referrer page from coming up? trakarkitekt JavaScript Forum 4 Apr 4th, 2007 02:12
problem with opening IE uddin Web Page Design 5 Mar 29th, 2007 15:26
javascript: onChange='document.archived.submit();' problem mameha1977 JavaScript Forum 3 Jun 23rd, 2006 09:57


All times are GMT. The time now is 21:21.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved