Click to See Complete Forum and Search --> : Problem with image values
nimbus3
01-07-2007, 06:58 AM
Hi all you fine people
I was wondering if one you could tell me what is wrong with this string.
matches[i].style.backgroundImage = document.styler.BackgroundImage.value;
its purpose is give a value from a selector (i.e images\glenbeigh-landscape.jpg) to the style property backgroundImage, but when i use this feature i get this error:
Error in parsing value for property 'background-image', declaration dropped.
and yet when i give the selector this script it works fine;
function incPic(imag)
{
doc.document.body.background = imag
}
in the first script segement in this thread, matches[i] is equal to a tag collected from another selector.
any help is appreciated.
document.body.background
refers to the HTML attribute background
Give this a try
matches[i].style.backgroundImage = "url("+document.styler.BackgroundImage.value+")"
nimbus3
01-07-2007, 07:25 AM
thank you Mr J
That works for IE which is the main one i need, but it appears to have trouble with firefox, i guess you could not advise without seeing the rest of the code.
What is
matches[i]
You may have to go
document.getElementById(matches[i]).style.backgroundImage = "url("+document.styler.BackgroundImage.value+")"
nimbus3
01-07-2007, 02:07 PM
here is the beginning of my code to explain what matches[i] is
if (parent.mainFrame.document.getElementsByTagName)
{
//sets a variable "matches" to the equivilant of document.getElementsByTagName(tn)... ehich in turn resolves its value from tn.
var matches = parent.mainFrame.document.getElementsByTagName(tn);
//loops round the selected tags using "matches.length" ...
for (var i=0; i<matches.length; i++)
to see the full script vist my other post "Using reset in methods " here:
http://www.webdeveloper.com/forum/showthread.php?t=133931 (http://http://www.webdeveloper.com/forum/showthread.php?t=133931)
and view the attached file this should give amuch better idea of how things are currently working and what they do
Are these correct?
if(document.getElementById('stylMen3').styledisplay = 'block')
if(document.getElementById('stylMen4').styledisplay = 'block')
if(document.getElementById('stylMen1').styledisplay = 'block')
if(document.getElementById('stylMen2').styledisplay = 'block')
should they not be
if(document.getElementById('stylMen3').style.display == 'block')
if(document.getElementById('stylMen4').style.display == 'block')
if(document.getElementById('stylMen1').style.display == 'block')
if(document.getElementById('stylMen2').style.display == 'block')
nimbus3
01-07-2007, 04:37 PM
oh yes so they should. ooopppppsssssssyy.
will give that a go .
thanks for pointing it out :)
nimbus3
01-07-2007, 04:46 PM
:( .. unfortunately that has not resolved it either ..
i am no longer conserned with the image url issue. i will resolve that at a later date.
for now i am consentrating on resolving the problem in the post i linked to.
the thing i do not understand is how to make a select tag active when its parent div style is set to display:block; and then inactive when it is set to display:none;
i have another copy of the script where i am attempting to correct my other problems trying to using the solution the other chap gave (i.e. .cloneNode method) not met with much success yet. but the night is still young. Although i would rather try to resolve the problem another way, the looking into what i said in the previous paragraph.