[Javascript] window location hash
Nick Fitzsimons
nick at nickfitz.co.uk
Fri Mar 23 10:48:41 CDT 2007
On 23 Mar 2007, at 15:34:57, Guillaume wrote:
> Matt,
>
> Error: hashValue is not defined
>
>> My only remaining idea is to try adding a delay.
>>
>> var hashValue = "bottomPage";
>> if (hashValue == window.location.hash)
>> {
>> window.location.hash = new String((new Date()).getMilliseconds());
>> }
>>
>> window.setTimeout('window.location.hash = hashValue;', 250);
>>
When the timeout is triggered, the "hashValue" variable is no longer
in scope; you can get round this with a closure and a proper function
object reference rather than a string:
window.setTimeout(function(){ window.location.hash = hashValue; }, 10);
(although there's still no guarantee it will solve the original
problem...)
Cheers,
Nick.
--
Nick Fitzsimons
http://www.nickfitz.co.uk/
More information about the Javascript
mailing list