PDA

View Full Version : js help



paynerd
01-03-2006, 05:04 PM
Ok I downloaded a script from DD (http://www.dynamicdrive.com/dynamicindex11/dhtmlprogress.htm changed it so that at the end of the 5 seconds it would just forward the user to the clans forums and it WORKS! But I have a problem, with how it works. It loads the forums in the frame of the clan page

this is what I have

var action=function()
{
window.open="www.theforums.com";
}

how do I get it to load the page outside the frames? I don't wanna use "window.open" because of pop-up blockers and such I just want it to forward the user. Any Help would be appreciated

Twey
01-03-2006, 05:15 PM
var action=function()
{
parent.location = "http://www.theforums.com/";
}By the by, window.open() is a function, not a variable (although the boundaries are a little blurred in Javascript; the above code won't [I think] produce an error, but neither will it produce the effect desired). You should call it with window.open("url"), not window.open = url.

paynerd
01-03-2006, 06:04 PM
WOO HOO!!! Thank You Twey it worked great in both IE6 and Firefox (test other later)
and it works exactly the way I wanted it to. :D

Thank you So much
Paynerd

mwinter
01-03-2006, 08:46 PM
By the by, window.open() is a function, not a variable [...]It's both. All variables, functions declarations, and formal arguments are properties of some object so they can be assigned to just like properties of a user-defined object[1]. For example:



function myFunction() {}

alert(typeof myFunction); /* function */

myFunction = 'value';

alert(typeof myFunction); /* string */
The open property is just a reference to a host function. Some third-party pop-up blockers operate by assigning their own function to that same property, replacing its functionality.

Mike


[1] There are exceptions. Some built-in properties are read-only where an assignment will be ignored, and host objects are free to act however they like (IE is known to throw exceptions when assigning to some host objects).