473,385 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to open a page(in the same browser window) when clicking

how do I open a page in the same browser window using onclick?

Jul 17 '05 #1
7 1859
Try to use
onclick="<script>window.location='page.html'</script>";

http://www.DevPlug.com --Connecting Developers
Posted from: http://www.devplug.com/ftopic32129.htm
Jul 17 '05 #2
ad***@devplug-dot-com.no-spam.invalid (rovisoft) wrote:

Try to use
onclick="<script>window.location='page.html'</script>";


The contents of an event handler are always Javascript, and the string
"<script>" is a syntax error in Javascript. Do this instead:

onClick="window.location='page.html'"
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 17 '05 #3
i get the answer object does not support this action

Jul 17 '05 #4
> Tim Robertswrote:
ad***@devplug-dot-com.no-spam.invalid (rovisoft) wrote:

Try to use
onclick="<script>window.location='page.html'</script>";

The contents of an event handler are always Javascript, and the
string
"<script>" is a syntax error in Javascript. Do this instead:

onClick="window.location='page.html'"
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.[/quote:f07927e48d]
by doing that it will still open a new browser window, isn't there a
way to keep it in the same window?

Jul 17 '05 #5
window.location=url shouldn't open a new window. It should change the
current window's location.

window.open() is used for opening new windows.

Browsers can override these settings, however. Maybe an option is set
to open all links in separate windows/tabs.

-aaron

Jul 17 '05 #6
LOL. Think before you post, people.

It should be onclick="location.href = 'page.html'". Window.location is
an object.

If you want the new page to replace the current page in the history,
use location.replace(url).

Jul 17 '05 #7
ra************@yahoo-dot-com.no-spam.invalid (clod) wrote:
Tim Robertswrote:

The contents of an event handler are always Javascript, and the
string "<script>" is a syntax error in Javascript. Do this instead:

onClick="window.location='page.html'"


by doing that it will still open a new browser window, isn't there a
way to keep it in the same window?


In saying that, you are simply confirming that you didn't even try it.

Assigning to window.location replaces the contents of the current browser
window. It does not open a new one.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Anna | last post by:
Hi all. I have a (hopefully) pretty simple question. I open a link in a new window: <a href="http://www.somewhere.com/some.hml"...
1
by: Michal Adamski | last post by:
I'm trying to make a popup. The code I pasted below works, but my problem is, that I want the http://www.mypage.com to open in the same browser window. So I need something instead of window.open()....
2
by: Mike Lambert | last post by:
I want to be able to open another web page in a new browser window from the one I am currently on? How do I accomplish this? I am currently just using the response.redirect method but can't find...
5
by: moondaddy | last post by:
I need to open a page in a new window from the code behind. Normally I use response.redirect to navigate to a new page but up to now its always been in the same window. I know how to do it from...
3
by: kermit | last post by:
Hi, I am hoping this is a foolish or simple question. I am creating a multiuser app. consisit of a login page and a dataentry page. If the user leaves the data entry page (other than exiting the...
4
by: Larry | last post by:
Hi All, How I can open a new web page in a web form? I know response.redirect("...aspx") will re-direct the current page to another. However, what I want is to remain the current page unchange...
1
by: mcmwhite | last post by:
Hi, Does anyone know how I can open a newly-created HTML page in a new window, using ASP.NET? Eg. I have an ASP.NET page which creates some new HTML, based on what the user has entered into a...
4
by: Gunawan | last post by:
Dear All, I would like to know how to disable 'open in a new tab' or 'open in a new window' feature coz I would like to maintain parameter using session id which is not change if we using those...
21
by: David C | last post by:
I have an ASP.Net page that does a Response.Redirect to a code-created url. Is there any way to code the redirect to open a new window similar to the Javascript window.open() ? Thanks. David
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.