if (parent.frames.main.location == 'mediaselect.html') {
I have a very simple frameset, name of frame where I'm checking is
'main'... why is this not working? I mean this is correct syntax,
right?? I also put a test alert, but alert does not come up if file
I'm testing for is loaded in 'main' frame.. thank you.. Frances 14 2014
"Frances Del Rio" wrote if (parent.frames.main.location == 'mediaselect.html') {
I have a very simple frameset, name of frame where I'm checking is 'main'... why is this not working? I mean this is correct syntax, right?? I also put a test alert, but alert does not come up if file I'm testing for is loaded in 'main' frame.. thank you.. Frances
You don't want the location object, but its href property.
Try
if (parent.frames.main.location.href == 'mediaselect.html') {
or
alert( parent.frames.main.location.href );
first perhaps.
And beware that all sorts of nasty cross-domain security restriction errors
happen if the main frame happens to contain a document from another domain.
--
Ivo
Ivo wrote: "Frances Del Rio" wrote if (parent.frames.main.location == 'mediaselect.html') {
I have a very simple frameset, name of frame where I'm checking is 'main'... why is this not working? I mean this is correct syntax, right?? I also put a test alert, but alert does not come up if
file I'm testing for is loaded in 'main' frame.. thank you.. Frances You don't want the location object, but its href property. Try if (parent.frames.main.location.href == 'mediaselect.html') { or alert( parent.frames.main.location.href ); first perhaps. And beware that all sorts of nasty cross-domain security restriction
errors happen if the main frame happens to contain a document from another
domain. -- Ivo
For most applications, the Location object - presumably due to its
importance - can be both written to & read as if it were a string (just
like its .href property). You're comparing a relative url to a
fully-qualified one. Try:
if (parent.frames.main.location.href.search('mediasel ect.html') > -1)
{....
Calling a String method so, you'll need that .href in this case.
RobB wrote: Ivo wrote:
"Frances Del Rio" wrote
if (parent.frames.main.location == 'mediaselect.html') {
I have a very simple frameset, name of frame where I'm checking is 'main'... why is this not working? I mean this is correct syntax, right?? I also put a test alert, but alert does not come up if file I'm testing for is loaded in 'main' frame.. thank you.. Frances
You don't want the location object, but its href property. Try if (parent.frames.main.location.href == 'mediaselect.html') { or alert( parent.frames.main.location.href ); first perhaps. And beware that all sorts of nasty cross-domain security restriction
errors
happen if the main frame happens to contain a document from another
domain.
-- Ivo
For most applications, the Location object - presumably due to its importance - can be both written to & read as if it were a string (just like its .href property). You're comparing a relative url to a fully-qualified one. Try:
if (parent.frames.main.location.href.search('mediasel ect.html') > -1) {....
Calling a String method so, you'll need that .href in this case.
thank you very much Rob & Ivo for yr responses.. ok, after following yr
suggestion this is what I now have...
<script language="JavaScript" type="text/javascript">
if (parent.frames.main.location.href.search('mediasel ect.html') > -1) {
// if (parent.frames.main.location.href == 'mediaselect.html') {
alert(' ')
document.write(" ")
} else {
document.write('<div id="sel"><a href="mediaselect.html" target="main">')
document.write('<img src="images/ch_media.jpg" name="selm" width="138"
height="24" border="0"></a></div>')
}
</script>
alert pops ok now, but: wben I switch to a file in that main frame
other than file mentioned in conditional cond. is still not met (i.e.,
that img/link still does not appear..)
I also tried this:
<script language="JavaScript" type="text/javascript">
if (parent.frames.main.location.href.search('audio.ht ml') > -1) {
document.write('<div id="sel"><a href="mediaselect.html" target="main">')
document.write('<img src="images/ch_media.jpg" name="selm" width="138"
height="24" border="0"></a></div>')
}
if (parent.frames.main.location.href.search('wmp.html ') > -1)
document.write('<div id="sel"><a href="mediaselect.html" target="main">')
document.write('<img src="images/ch_media.jpg" name="selm" width="138"
height="24" border="0"></a></div>')
}
</script>
and got exact same result..
this:
if (parent.frames.main.location.href.search('audio.ht ml') > -1) ||
(parent.frames.main.location.href.search('audio.ht ml') > -1) {
gave me an error on those '||'...... don't know what that's about either..
I don't understand why this is such a problem... I also use this
(to make sure a certain file is loaded in a frame when I reload):
function loc() {
parent.frames.main.location = 'mediaselect.html'
}
and call function in onload event handler in body tag.. and this works
fine.. why is testing whether or not a certain file is loaded in a frame
such a problem? again, many thanks for yr help.. Frances
Frances Del Rio wrote:
RobB wrote:
Ivo wrote:
"Frances Del Rio" wrote
if (parent.frames.main.location == 'mediaselect.html') {
I have a very simple frameset, name of frame where I'm checking is 'main'... why is this not working? I mean this is correct syntax, right?? I also put a test alert, but alert does not come up if
file
I'm testing for is loaded in 'main' frame.. thank you.. Frances
You don't want the location object, but its href property. Try if (parent.frames.main.location.href == 'mediaselect.html') { or alert( parent.frames.main.location.href ); first perhaps. And beware that all sorts of nasty cross-domain security restriction
errors
happen if the main frame happens to contain a document from another
domain.
-- Ivo For most applications, the Location object - presumably due to its importance - can be both written to & read as if it were a string (just like its .href property). You're comparing a relative url to a fully-qualified one. Try:
if (parent.frames.main.location.href.search('mediasel ect.html') > -1) {....
Calling a String method so, you'll need that .href in this case.
thank you very much Rob & Ivo for yr responses.. ok, after following yr suggestion this is what I now have...
<script language="JavaScript" type="text/javascript"> if (parent.frames.main.location.href.search('mediasel ect.html') > -1) { // if (parent.frames.main.location.href == 'mediaselect.html') { alert(' ') document.write(" ") } else { document.write('<div id="sel"><a href="mediaselect.html" target="main">') document.write('<img src="images/ch_media.jpg" name="selm" width="138" height="24" border="0"></a></div>') } </script>
alert pops ok now, but: wben I switch to a file in that main frame other than file mentioned in conditional cond. is still not met (i.e., that img/link still does not appear..)
I also tried this:
<script language="JavaScript" type="text/javascript"> if (parent.frames.main.location.href.search('audio.ht ml') > -1) { document.write('<div id="sel"><a href="mediaselect.html" target="main">') document.write('<img src="images/ch_media.jpg" name="selm" width="138" height="24" border="0"></a></div>') } if (parent.frames.main.location.href.search('wmp.html ') > -1) document.write('<div id="sel"><a href="mediaselect.html" target="main">') document.write('<img src="images/ch_media.jpg" name="selm" width="138" height="24" border="0"></a></div>') } </script>
and got exact same result.. this: if (parent.frames.main.location.href.search('audio.ht ml') > -1) || (parent.frames.main.location.href.search('audio.ht ml') > -1) {
gave me an error on those '||'...... don't know what that's about either..
I don't understand why this is such a problem... I also use this (to make sure a certain file is loaded in a frame when I reload):
function loc() { parent.frames.main.location = 'mediaselect.html' }
and call function in onload event handler in body tag.. and this works fine.. why is testing whether or not a certain file is loaded in a frame such a problem? again, many thanks for yr help.. Frances
ooopss.. had forgotten a '{'.. but even after correcting this it's still
not working.. now I put everything in a function..
function check() {
if (parent.frames.main.location.href.search('audio.ht ml') > -1) {
alert('')
document.write('<div id="sel"><a href="mediaselect.html" target="main">')
document.write('<img src="images/ch_media.jpg" name="selm" width="138"
height="24" border="0"></a></div>')
}
if (parent.frames.main.location.href.search('wmp.html ') > -1) {
alert('')
document.write('<div id="sel"><a href="mediaselect.html" target="main">')
document.write('<img src="images/ch_media.jpg" name="selm" width="138"
height="24" border="0"></a></div>')
}
}
and call function in body of file.. (also tried calling function in
body tag.. (onload... etc...)
<script language="JavaScript" type="text/javascript">
check();
</script>
I do get alert now, but if wmp.html or audio.html are loaded img/link I
want does not appear... I want it to appear if either of these two
files are loaded in 'main' frame; is 'mediaselect.html' is loaded I
don't want it to appear..) again, thank you for your help.. Frances
Frances Del Rio wrote: Frances Del Rio wrote:
RobB wrote:
Ivo wrote:
"Frances Del Rio" wrote
> if (parent.frames.main.location == 'mediaselect.html') { > > I have a very simple frameset, name of frame where I'm checking
is> 'main'... why is this not working? I mean this is correct
syntax,> right?? I also put a test alert, but alert does not come up if
file
> I'm testing for is loaded in 'main' frame.. thank you..
Frances
You don't want the location object, but its href property. Try if (parent.frames.main.location.href == 'mediaselect.html') { or alert( parent.frames.main.location.href ); first perhaps. And beware that all sorts of nasty cross-domain security
restriction
errors
happen if the main frame happens to contain a document from
another
domain.
-- Ivo For most applications, the Location object - presumably due to its importance - can be both written to & read as if it were a string
(just like its .href property). You're comparing a relative url to a fully-qualified one. Try:
if (parent.frames.main.location.href.search('mediasel ect.html') >
-1) {....
Calling a String method so, you'll need that .href in this case.
thank you very much Rob & Ivo for yr responses.. ok, after
following yr suggestion this is what I now have...
<script language="JavaScript" type="text/javascript"> if (parent.frames.main.location.href.search('mediasel ect.html') >
-1) { // if (parent.frames.main.location.href == 'mediaselect.html') { alert(' ') document.write(" ") } else { document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } </script>
alert pops ok now, but: wben I switch to a file in that main frame
other than file mentioned in conditional cond. is still not met
(i.e., that img/link still does not appear..)
I also tried this:
<script language="JavaScript" type="text/javascript"> if (parent.frames.main.location.href.search('audio.ht ml') > -1) { document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } if (parent.frames.main.location.href.search('wmp.html ') > -1) document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } </script>
and got exact same result.. this: if (parent.frames.main.location.href.search('audio.ht ml') > -1) || (parent.frames.main.location.href.search('audio.ht ml') > -1) {
gave me an error on those '||'...... don't know what that's about
either.. I don't understand why this is such a problem... I also use this (to make sure a certain file is loaded in a frame when I reload):
function loc() { parent.frames.main.location = 'mediaselect.html' }
and call function in onload event handler in body tag.. and this
works fine.. why is testing whether or not a certain file is loaded in a
frame such a problem? again, many thanks for yr help.. Frances
ooopss.. had forgotten a '{'.. but even after correcting this it's
still not working.. now I put everything in a function..
function check() { if (parent.frames.main.location.href.search('audio.ht ml') > -1) { alert('') document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } if (parent.frames.main.location.href.search('wmp.html ') > -1) { alert('') document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } }
and call function in body of file.. (also tried calling function in body tag.. (onload... etc...)
<script language="JavaScript" type="text/javascript"> check(); </script>
I do get alert now, but if wmp.html or audio.html are loaded img/link
I want does not appear... I want it to appear if either of these two files are loaded in 'main' frame; is 'mediaselect.html' is loaded I don't want it to appear..) again, thank you for your help.. Frances
Can't call document.write() on a loaded document as it discards the
current one, although it may appear to be successful in some browsers.
Try including that div in the original page and setting its .innerHTML
property (document.getElementById('sel').innerHTML) to the link/img
HTML string you need.
Frances Del Rio wrote: Frances Del Rio wrote:
RobB wrote:
Ivo wrote:
"Frances Del Rio" wrote
> if (parent.frames.main.location == 'mediaselect.html') { > > I have a very simple frameset, name of frame where I'm checking
is> 'main'... why is this not working? I mean this is correct
syntax,> right?? I also put a test alert, but alert does not come up if
file
> I'm testing for is loaded in 'main' frame.. thank you..
Frances
You don't want the location object, but its href property. Try if (parent.frames.main.location.href == 'mediaselect.html') { or alert( parent.frames.main.location.href ); first perhaps. And beware that all sorts of nasty cross-domain security
restriction
errors
happen if the main frame happens to contain a document from
another
domain.
-- Ivo For most applications, the Location object - presumably due to its importance - can be both written to & read as if it were a string
(just like its .href property). You're comparing a relative url to a fully-qualified one. Try:
if (parent.frames.main.location.href.search('mediasel ect.html') >
-1) {....
Calling a String method so, you'll need that .href in this case.
thank you very much Rob & Ivo for yr responses.. ok, after
following yr suggestion this is what I now have...
<script language="JavaScript" type="text/javascript"> if (parent.frames.main.location.href.search('mediasel ect.html') >
-1) { // if (parent.frames.main.location.href == 'mediaselect.html') { alert(' ') document.write(" ") } else { document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } </script>
alert pops ok now, but: wben I switch to a file in that main frame
other than file mentioned in conditional cond. is still not met
(i.e., that img/link still does not appear..)
I also tried this:
<script language="JavaScript" type="text/javascript"> if (parent.frames.main.location.href.search('audio.ht ml') > -1) { document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } if (parent.frames.main.location.href.search('wmp.html ') > -1) document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } </script>
and got exact same result.. this: if (parent.frames.main.location.href.search('audio.ht ml') > -1) || (parent.frames.main.location.href.search('audio.ht ml') > -1) {
gave me an error on those '||'...... don't know what that's about
either.. I don't understand why this is such a problem... I also use this (to make sure a certain file is loaded in a frame when I reload):
function loc() { parent.frames.main.location = 'mediaselect.html' }
and call function in onload event handler in body tag.. and this
works fine.. why is testing whether or not a certain file is loaded in a
frame such a problem? again, many thanks for yr help.. Frances
ooopss.. had forgotten a '{'.. but even after correcting this it's
still not working.. now I put everything in a function..
function check() { if (parent.frames.main.location.href.search('audio.ht ml') > -1) { alert('') document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } if (parent.frames.main.location.href.search('wmp.html ') > -1) { alert('') document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } }
and call function in body of file.. (also tried calling function in body tag.. (onload... etc...)
<script language="JavaScript" type="text/javascript"> check(); </script>
I do get alert now, but if wmp.html or audio.html are loaded img/link
I want does not appear... I want it to appear if either of these two files are loaded in 'main' frame; is 'mediaselect.html' is loaded I don't want it to appear..) again, thank you for your help.. Frances
Can't call document.write() on a loaded document as it discards the
current one, although it may appear to be successful in some browsers.
Try including that div in the original page and setting its .innerHTML
property (document.getElementById('sel').innerHTML) to the link/img
HTML string you need.
Frances Del Rio wrote: Frances Del Rio wrote:
RobB wrote:
Ivo wrote:
"Frances Del Rio" wrote
> if (parent.frames.main.location == 'mediaselect.html') { > > I have a very simple frameset, name of frame where I'm checking
is> 'main'... why is this not working? I mean this is correct
syntax,> right?? I also put a test alert, but alert does not come up if
file
> I'm testing for is loaded in 'main' frame.. thank you..
Frances
You don't want the location object, but its href property. Try if (parent.frames.main.location.href == 'mediaselect.html') { or alert( parent.frames.main.location.href ); first perhaps. And beware that all sorts of nasty cross-domain security
restriction
errors
happen if the main frame happens to contain a document from
another
domain.
-- Ivo For most applications, the Location object - presumably due to its importance - can be both written to & read as if it were a string
(just like its .href property). You're comparing a relative url to a fully-qualified one. Try:
if (parent.frames.main.location.href.search('mediasel ect.html') >
-1) {....
Calling a String method so, you'll need that .href in this case.
thank you very much Rob & Ivo for yr responses.. ok, after
following yr suggestion this is what I now have...
<script language="JavaScript" type="text/javascript"> if (parent.frames.main.location.href.search('mediasel ect.html') >
-1) { // if (parent.frames.main.location.href == 'mediaselect.html') { alert(' ') document.write(" ") } else { document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } </script>
alert pops ok now, but: wben I switch to a file in that main frame
other than file mentioned in conditional cond. is still not met
(i.e., that img/link still does not appear..)
I also tried this:
<script language="JavaScript" type="text/javascript"> if (parent.frames.main.location.href.search('audio.ht ml') > -1) { document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } if (parent.frames.main.location.href.search('wmp.html ') > -1) document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } </script>
and got exact same result.. this: if (parent.frames.main.location.href.search('audio.ht ml') > -1) || (parent.frames.main.location.href.search('audio.ht ml') > -1) {
gave me an error on those '||'...... don't know what that's about
either.. I don't understand why this is such a problem... I also use this (to make sure a certain file is loaded in a frame when I reload):
function loc() { parent.frames.main.location = 'mediaselect.html' }
and call function in onload event handler in body tag.. and this
works fine.. why is testing whether or not a certain file is loaded in a
frame such a problem? again, many thanks for yr help.. Frances
ooopss.. had forgotten a '{'.. but even after correcting this it's
still not working.. now I put everything in a function..
function check() { if (parent.frames.main.location.href.search('audio.ht ml') > -1) { alert('') document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } if (parent.frames.main.location.href.search('wmp.html ') > -1) { alert('') document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } }
and call function in body of file.. (also tried calling function in body tag.. (onload... etc...)
<script language="JavaScript" type="text/javascript"> check(); </script>
I do get alert now, but if wmp.html or audio.html are loaded img/link
I want does not appear... I want it to appear if either of these two files are loaded in 'main' frame; is 'mediaselect.html' is loaded I don't want it to appear..) again, thank you for your help.. Frances
Can't call document.write() on a loaded document as it discards the
current one, although it may appear to be successful in some browsers.
Try including that div in the original page and setting its .innerHTML
property (document.getElementById('sel').innerHTML) to the link/img
HTML string you need.
Frances Del Rio wrote: Frances Del Rio wrote:
RobB wrote:
Ivo wrote:
"Frances Del Rio" wrote
> if (parent.frames.main.location == 'mediaselect.html') { > > I have a very simple frameset, name of frame where I'm checking
is> 'main'... why is this not working? I mean this is correct
syntax,> right?? I also put a test alert, but alert does not come up if
file
> I'm testing for is loaded in 'main' frame.. thank you..
Frances
You don't want the location object, but its href property. Try if (parent.frames.main.location.href == 'mediaselect.html') { or alert( parent.frames.main.location.href ); first perhaps. And beware that all sorts of nasty cross-domain security
restriction
errors
happen if the main frame happens to contain a document from
another
domain.
-- Ivo For most applications, the Location object - presumably due to its importance - can be both written to & read as if it were a string
(just like its .href property). You're comparing a relative url to a fully-qualified one. Try:
if (parent.frames.main.location.href.search('mediasel ect.html') >
-1) {....
Calling a String method so, you'll need that .href in this case.
thank you very much Rob & Ivo for yr responses.. ok, after
following yr suggestion this is what I now have...
<script language="JavaScript" type="text/javascript"> if (parent.frames.main.location.href.search('mediasel ect.html') >
-1) { // if (parent.frames.main.location.href == 'mediaselect.html') { alert(' ') document.write(" ") } else { document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } </script>
alert pops ok now, but: wben I switch to a file in that main frame
other than file mentioned in conditional cond. is still not met
(i.e., that img/link still does not appear..)
I also tried this:
<script language="JavaScript" type="text/javascript"> if (parent.frames.main.location.href.search('audio.ht ml') > -1) { document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } if (parent.frames.main.location.href.search('wmp.html ') > -1) document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } </script>
and got exact same result.. this: if (parent.frames.main.location.href.search('audio.ht ml') > -1) || (parent.frames.main.location.href.search('audio.ht ml') > -1) {
gave me an error on those '||'...... don't know what that's about
either.. I don't understand why this is such a problem... I also use this (to make sure a certain file is loaded in a frame when I reload):
function loc() { parent.frames.main.location = 'mediaselect.html' }
and call function in onload event handler in body tag.. and this
works fine.. why is testing whether or not a certain file is loaded in a
frame such a problem? again, many thanks for yr help.. Frances
ooopss.. had forgotten a '{'.. but even after correcting this it's
still not working.. now I put everything in a function..
function check() { if (parent.frames.main.location.href.search('audio.ht ml') > -1) { alert('') document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } if (parent.frames.main.location.href.search('wmp.html ') > -1) { alert('') document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } }
and call function in body of file.. (also tried calling function in body tag.. (onload... etc...)
<script language="JavaScript" type="text/javascript"> check(); </script>
I do get alert now, but if wmp.html or audio.html are loaded img/link
I want does not appear... I want it to appear if either of these two files are loaded in 'main' frame; is 'mediaselect.html' is loaded I don't want it to appear..) again, thank you for your help.. Frances
Can't call document.write() on a loaded document as it discards the
current one, although it may appear to be successful in some browsers.
Try including that div in the original page and setting its .innerHTML
property (document.getElementById('sel').innerHTML) to the link/img
HTML string you need.
Frances Del Rio wrote: Frances Del Rio wrote:
RobB wrote:
Ivo wrote:
"Frances Del Rio" wrote
> if (parent.frames.main.location == 'mediaselect.html') { > > I have a very simple frameset, name of frame where I'm checking
is> 'main'... why is this not working? I mean this is correct
syntax,> right?? I also put a test alert, but alert does not come up if
file
> I'm testing for is loaded in 'main' frame.. thank you..
Frances
You don't want the location object, but its href property. Try if (parent.frames.main.location.href == 'mediaselect.html') { or alert( parent.frames.main.location.href ); first perhaps. And beware that all sorts of nasty cross-domain security
restriction
errors
happen if the main frame happens to contain a document from
another
domain.
-- Ivo For most applications, the Location object - presumably due to its importance - can be both written to & read as if it were a string
(just like its .href property). You're comparing a relative url to a fully-qualified one. Try:
if (parent.frames.main.location.href.search('mediasel ect.html') >
-1) {....
Calling a String method so, you'll need that .href in this case.
thank you very much Rob & Ivo for yr responses.. ok, after
following yr suggestion this is what I now have...
<script language="JavaScript" type="text/javascript"> if (parent.frames.main.location.href.search('mediasel ect.html') >
-1) { // if (parent.frames.main.location.href == 'mediaselect.html') { alert(' ') document.write(" ") } else { document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } </script>
alert pops ok now, but: wben I switch to a file in that main frame
other than file mentioned in conditional cond. is still not met
(i.e., that img/link still does not appear..)
I also tried this:
<script language="JavaScript" type="text/javascript"> if (parent.frames.main.location.href.search('audio.ht ml') > -1) { document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } if (parent.frames.main.location.href.search('wmp.html ') > -1) document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } </script>
and got exact same result.. this: if (parent.frames.main.location.href.search('audio.ht ml') > -1) || (parent.frames.main.location.href.search('audio.ht ml') > -1) {
gave me an error on those '||'...... don't know what that's about
either.. I don't understand why this is such a problem... I also use this (to make sure a certain file is loaded in a frame when I reload):
function loc() { parent.frames.main.location = 'mediaselect.html' }
and call function in onload event handler in body tag.. and this
works fine.. why is testing whether or not a certain file is loaded in a
frame such a problem? again, many thanks for yr help.. Frances
ooopss.. had forgotten a '{'.. but even after correcting this it's
still not working.. now I put everything in a function..
function check() { if (parent.frames.main.location.href.search('audio.ht ml') > -1) { alert('') document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } if (parent.frames.main.location.href.search('wmp.html ') > -1) { alert('') document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } }
and call function in body of file.. (also tried calling function in body tag.. (onload... etc...)
<script language="JavaScript" type="text/javascript"> check(); </script>
I do get alert now, but if wmp.html or audio.html are loaded img/link
I want does not appear... I want it to appear if either of these two files are loaded in 'main' frame; is 'mediaselect.html' is loaded I don't want it to appear..) again, thank you for your help.. Frances
Can't call document.write() on a loaded document as it discards the
current one, although it may appear to be successful in some browsers.
Try including that div in the original page and setting its .innerHTML
property (document.getElementById('sel').innerHTML) to the link/img
HTML string you need.
Frances Del Rio wrote: Frances Del Rio wrote:
RobB wrote:
Ivo wrote:
"Frances Del Rio" wrote
> if (parent.frames.main.location == 'mediaselect.html') { > > I have a very simple frameset, name of frame where I'm checking
is> 'main'... why is this not working? I mean this is correct
syntax,> right?? I also put a test alert, but alert does not come up if
file
> I'm testing for is loaded in 'main' frame.. thank you..
Frances
You don't want the location object, but its href property. Try if (parent.frames.main.location.href == 'mediaselect.html') { or alert( parent.frames.main.location.href ); first perhaps. And beware that all sorts of nasty cross-domain security
restriction
errors
happen if the main frame happens to contain a document from
another
domain.
-- Ivo For most applications, the Location object - presumably due to its importance - can be both written to & read as if it were a string
(just like its .href property). You're comparing a relative url to a fully-qualified one. Try:
if (parent.frames.main.location.href.search('mediasel ect.html') >
-1) {....
Calling a String method so, you'll need that .href in this case.
thank you very much Rob & Ivo for yr responses.. ok, after following
yr suggestion this is what I now have...
<script language="JavaScript" type="text/javascript"> if (parent.frames.main.location.href.search('mediasel ect.html') >
-1) { // if (parent.frames.main.location.href == 'mediaselect.html') { alert(' ') document.write(" ") } else { document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } </script>
alert pops ok now, but: wben I switch to a file in that main frame other than file mentioned in conditional cond. is still not met
(i.e., that img/link still does not appear..)
I also tried this:
<script language="JavaScript" type="text/javascript"> if (parent.frames.main.location.href.search('audio.ht ml') > -1) { document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } if (parent.frames.main.location.href.search('wmp.html ') > -1) document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm"
width="138" height="24" border="0"></a></div>') } </script>
and got exact same result.. this: if (parent.frames.main.location.href.search('audio.ht ml') > -1) || (parent.frames.main.location.href.search('audio.ht ml') > -1) {
gave me an error on those '||'...... don't know what that's about
either.. I don't understand why this is such a problem... I also use this (to make sure a certain file is loaded in a frame when I reload):
function loc() { parent.frames.main.location = 'mediaselect.html' }
and call function in onload event handler in body tag.. and this
works fine.. why is testing whether or not a certain file is loaded in a
frame such a problem? again, many thanks for yr help.. Frances
ooopss.. had forgotten a '{'.. but even after correcting this it's
still not working.. now I put everything in a function..
function check() { if (parent.frames.main.location.href.search('audio.ht ml') > -1) { alert('') document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm" width="138" height="24" border="0"></a></div>') } if (parent.frames.main.location.href.search('wmp.html ') > -1) { alert('') document.write('<div id="sel"><a href="mediaselect.html"
target="main">') document.write('<img src="images/ch_media.jpg" name="selm" width="138" height="24" border="0"></a></div>') } }
and call function in body of file.. (also tried calling function in body tag.. (onload... etc...)
<script language="JavaScript" type="text/javascript"> check(); </script>
I do get alert now, but if wmp.html or audio.html are loaded img/link
I want does not appear... I want it to appear if either of these two files are loaded in 'main' frame; is 'mediaselect.html' is loaded I don't want it to appear..) again, thank you for your help.. Frances
Can't call document.write() on a loaded document as it discards the
current one, although it may appear to be successful in some browsers.
Try including that div in the original page and setting its .innerHTML
property (document.getElementById('sel').innerHTML) to the link/img HTML
string you need.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
....death to googlegroups !
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
JRS: In article <11********************@c13g2000cwb.googlegroups.c om>,
dated Tue, 14 Dec 2004 15:16:24, seen in news:comp.lang.javascript, RobB
<fe******@hotmail.com> posted : Lines: 169
Can't call document.write() on a loaded document as it discards the current one, although it may appear to be successful in some browsers. Try including that div in the original page and setting its .innerHTML property (document.getElementById('sel').innerHTML) to the link/img HTML string you need.
Please do not quote excessively; it wastes time and resources which are
not yours. FAQ 2.3 para 6 refers.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME ©
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Dr John Stockton wrote: JRS: In article
<11********************@c13g2000cwb.googlegroups.c om>, dated Tue, 14 Dec 2004 15:16:24, seen in news:comp.lang.javascript,
RobB <fe******@hotmail.com> posted :
Lines: 169Can't call document.write() on a loaded document as it discards the current one, although it may appear to be successful in some
browsers.Try including that div in the original page and setting its
..innerHTMLproperty (document.getElementById('sel').innerHTML) to the link/img HTML string you need.
Please do not quote excessively; it wastes time and resources which
are not yours. FAQ 2.3 para 6 refers.
-- © John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00
MIME © Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi:
Usenet Q&A. Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage
of News. No Encoding. Quotes before replies. Snip well. Write clearly. Don't
Mail News.
Dr. John:
Hoped my other (OT) comment would be self-explanatory. Please contact
googlegroups w/all complaints. Have no idea what is amiss...
Rob
JRS: In article <11**********************@z14g2000cwz.googlegroups .com>
, dated Thu, 16 Dec 2004 12:12:00, seen in news:comp.lang.javascript,
RobB <fe******@hotmail.com> posted : Lines: 38
Dr John Stockton wrote: JRS: In article <11********************@c13g2000cwb.googlegroups. com>, dated Tue, 14 Dec 2004 15:16:24, seen in news:comp.lang.javascript, RobB <fe******@hotmail.com> posted :
>Lines: 169
Please do not quote excessively; it wastes time and resources which are not yours. FAQ 2.3 para 6 refers. ... News.
Dr. John:
Hoped my other (OT) comment would be self-explanatory. Please contact googlegroups w/all complaints. Have no idea what is amiss...
Please do not quote excessively; it wastes time and resources which
are not yours. FAQ 2.3 para 6 refers. Read it. Don't blame the
service you chose to use; if necessary, blame your choice of service.
By the way, we already have a RobX, for some X in [A, C..Z]; like is
easier for others if authors use real (or simulated real) names of
sufficient length.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME ©
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News. This discussion thread is closed Replies have been disabled for this discussion. Similar topics
3 posts
views
Thread by foldface |
last post: by
|
4 posts
views
Thread by Mark |
last post: by
|
2 posts
views
Thread by JPL Verhey |
last post: by
|
4 posts
views
Thread by Andrew Poulos |
last post: by
|
3 posts
views
Thread by Jim Cobban |
last post: by
|
3 posts
views
Thread by bfmcfarlane |
last post: by
|
6 posts
views
Thread by Sunfire |
last post: by
| | | | | | | | | | |