Having some problems picking strings out of window.location...
--------
section = window.location;
document.write(section);
--------
The above code writes the url to the browser. Good so far.
--------
section = "abcde";
document.write(section.indexOf("c"
);
--------
The above code writes "2" to the browser. "c" is the third letter starting from zero, so at least I know I'm using indexOf properly.
--------
section = window.location;
document.write(section.indexOf("h"
);
--------
This is where things get a little weird. I know there's an "h" in there, so this should have written "0" to the browser. Instead, it has decided that an object suddenly "doesn't support this property or method". The funny thing is that the error references a line number somewhere else in my script. It's actually choking on the MM_preloadImages() function now (I think that function came from Dreamweaver). Here's that function:
--------
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a.indexOf("#"
!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}
--------
So... I have no idea what the issue is. I see that the MM_preloadImages() function also uses the indexOf method. I
Why did it work fine for just strings but now window.location makes MM_preloadImages go crazy?
Is there a better way to do this? All I need to do is find a specific string within the current URL.
Thanks in advance!
--------
section = window.location;
document.write(section);
--------
The above code writes the url to the browser. Good so far.
--------
section = "abcde";
document.write(section.indexOf("c"
--------
The above code writes "2" to the browser. "c" is the third letter starting from zero, so at least I know I'm using indexOf properly.
--------
section = window.location;
document.write(section.indexOf("h"
--------
This is where things get a little weird. I know there's an "h" in there, so this should have written "0" to the browser. Instead, it has decided that an object suddenly "doesn't support this property or method". The funny thing is that the error references a line number somewhere else in my script. It's actually choking on the MM_preloadImages() function now (I think that function came from Dreamweaver). Here's that function:
--------
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a.indexOf("#"
}
--------
So... I have no idea what the issue is. I see that the MM_preloadImages() function also uses the indexOf method. I
Why did it work fine for just strings but now window.location makes MM_preloadImages go crazy?
Is there a better way to do this? All I need to do is find a specific string within the current URL.
Thanks in advance!