GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Help with some .js code (https://gfy.com/showthread.php?t=815227)

spunkmaster 03-15-2008 12:24 AM

Help with some .js code
 
How do I make this open in the same window instead of a new one ?

GoTo = new Array();
GoTo[0]= 'http://www.some url.com';

J.P. 03-15-2008 03:08 AM

location.href = GoTo[0];

spunkmaster 03-16-2008 07:46 PM

I changed it to location.href = GoTo[0]; but it goes to the
page without being clicked on ?

mikeyddddd 03-16-2008 09:53 PM

Put the code into a function:

function name_it_what_ya_want( ) {
GoTo = new Array();
GoTo[0]= 'http://www.some url.com';
location.href = GoTo[0];
}

Make an anchor to use the function:

<a href="javascript:name_it_what_ya_want()">now it goes to some url</a>

mikeyddddd 03-16-2008 10:01 PM

I assume the GoTo array is a list of URL's you are processing and [0] could be a variable number within the array count?

spunkmaster 03-16-2008 10:52 PM

When I add this it automatically goes to the new page without being clicked ?

J.P. 03-17-2008 04:34 AM

spunkmaster, as mikeyddd said, put in in a function and execute it from the href or onclick event...


All times are GMT -7. The time now is 12:55 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123