Change background repeat image with JavaScript?

Write a CSS class and call it in your JavaScript like this document. GetElementById("menu_" + modid + "_" + i). ClassName = "yourcssclass and see what happens.

Write a CSS class and call it in your JavaScript like this document. GetElementById("menu_" + modid + "_" + i). ClassName = "yourcssclass" and see what happens.

Thank you very much for your help. Your solution worked fine :) – ktsixit Dec 15 '09 at 11:30 2 Then try accepting my answer – Chendur Pandian Dec 15 '09 at 11:35 Here is a +1 for solving his problem – alex Dec 15 '09 at 11:49.

I.e. Also, as an aside, your multiple calls to getElementById isn't helping your readibility or performance Try something like this: var objElem = document. GetElementById("content_" + modid + "_" + i); while (objElem!

= null) { objElem.style. Display = "none"; objElem.style. BackgroundImage = "url('psycho_normal.

Jpg')"; objElem.style. BackgroundPosition = "top left"; objElem.style. BackgroundRepeat = "repeat-x"; i++; objElem = document.

GetElementById("content_" + modid + "_" + i); } //same idea with these: document. GetElementById("menu_" + modid + "_" + ind).style. BackgroundImage = "url('phycho_hover.

Jpg')"; document. GetElementById("menu_" + modid + "_" + ind).style. BackgroundPosition = "top left"; document.

GetElementById("menu_" + modid + "_" + ind).style. BackgroundRepeat = "repeat-x.

Easier to read yes, would be even easier to read (and write) using a Javascript framework like jQuery :) – Sune Rievers Dec 15 '09 at 11:41.

This code works for me. Maybe you have a bug in your code somewhere? Try enabling the JavaScript console in your browser and see if anything is logged there.

Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.

And thank you for your answer. I tried what you suggested but didn't work. – ktsixit Dec 15 '09 at 11:24 Edited my answer regarding the code, should work now – Sune Rievers Dec 15 '09 at 15:50.

BackgroundImage = "url(phycho_hover. GetElementById("menu_" + modid + "_" + ind).style. GetElementById("menu_" + modid + "_" + ind).style.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions