We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
js to open new page when entering?; so it opens new page in new widow
Topic Started: Mar 22 2005, 07:51 PM (473 Views)
spdr
Member
[ * ]
i need the java script to open a new page in the same window, before the current page loads... anyhelp? thanks.
Offline Profile Quote Post Goto Top
 
Sani
Member Avatar
Member
[ *  *  *  *  * ]
Try this..
In your <head></head> tags..
Code:
 
<script language="JavaScript">

<!--
function omg() {
var newWin = window.open("page1.htm", "method_desc", "status=no,width=755,height=480")
}
// -->

</script>

then, change your <body> tag to..
Code:
 
<body onload="omg();return false;">


It should work.. :)
Offline Profile Quote Post Goto Top
 
spdr
Member
[ * ]
newWin, so how do i open it up in the same window?
Offline Profile Quote Post Goto Top
 
Stefan
Member Avatar
Mew?
[ *  *  *  *  *  *  * ]
You don't need javascript to do it, HTML will do:

Quote:
 
<meta http-equiv="refresh" content="0;url=http://www.something.com/" />

Replace the red with the URL you want to open.
Offline Profile Quote Post Goto Top
 
Sani
Member Avatar
Member
[ *  *  *  *  * ]
Oh.. My bad, I thought spdr wanted to open a new window.. :P
Offline Profile Quote Post Goto Top
 
MegaKN
Ketchup is for winners, Ted.
[ *  *  *  *  * ]
Or you could use PHP:

Code:
 

<?php

header("Location: http://url.com");

?>
Offline Profile Quote Post Goto Top
 
Rory
i;m a mess
[ *  *  *  *  *  *  * ]
But they asked for JavaScript, so not much point giving the php version?
Offline Profile Quote Post Goto Top
 
MegaKN
Ketchup is for winners, Ted.
[ *  *  *  *  * ]
I'm giving him an alternative way while teaching him a bit of PHP. I would think that's helpful. :/
Offline Profile Quote Post Goto Top
 
nickoladze
Member
[ * ]
yeah php is better in the long-run :)
Offline Profile Quote Post Goto Top
 
Rory
i;m a mess
[ *  *  *  *  *  *  * ]
I suppose it depends on if PHP is availiable or not. Seeing as php is pretty different to use and there is a fair chance PHP isn't availiable, it might have been better to explain that.

Offline Profile Quote Post Goto Top
 
spdr
Member
[ * ]
Code:
 
<script type="text/javascript">
<!--
function delayer(){
document.location = "http://xwpx.goldeye.info/xwpx-reborn/main.html"
}
//-->
</script>
</head>
<body onLoad="setTimeout('delayer()', 5000)">


this is the one im using. thanks tho. this takes 5 seconds, but i could make it shorter if i wanted. tho i found when i used 1 second 1000, it didnt work. thanks anyway. and no, geocities does not support php, (as far as i know.) but thanks again.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Technology Chat · Next Topic »
Add Reply