Hi everyOne;
I wrote this JS for my webPage but;I couldnt make it work for Mozilla or Firefox and I couldn't find a proper solution.Can you help me about this?
I want to change my buttons images without refreshing the frame.But in Mozilla and Firefox document.getElementById() returns me "has no properties " error.What can i do for solving this problem and work my JS for them...
Thanks for Your consideration
Best Regards
<script language="JavaScript">
root="";
rootImg="";
var prevClicked = "";
var prevImagename ="";
Fullpath="Imgpath="../images/styleguide/";
function setRoot(rootId,rootImage)
{
root=rootId;
rootImg=rootImage;
}
function SwapImageMouseOver(current,imgName)
{
tmpStr2 = current.toString();
var source="";
if(document.getElementById){
source = document.getElementById(current).src.toString();
}else if(document.all)
{
source = document.all[current].src.toString();
}else if(document.layers)
{
source = document.layers[current].src.toString();
}
var controlsource=Fullpath+imgName+'_prs.gif';
if(source.toString() != controlsource.toString())
{
if(document.getElementById){
document.getElementById (current).src=Imgpath+imgName+'_ovr.gif';
}else if (document.all){
document.all[current].src=Imgpath+imgName+'_ovr.gif';
}else if(document.layers){
document.layers[current].src=Imgpath+imgName+'_ovr.gif';
}
}
}
function SwapImageMouseOut(current,imgName) {
tmpStr2 = current.toString();
var source = "";
var controlsource=Fullpath+imgName+'_prs.gif';
if(document.getElementById){
source = document.getElementById(current).src.toString();
}else if(document.all)
{
source = document.all[current].src.toString();
}else if(document.layers)
{
source = document.layers[current].src.toString();
}
if(source.toString() !=controlsource.toString())
{
if(document.getElementById){
document.getElementById (current).src=Imgpath+imgName+'_def.gif';
}else if (document.all){
document.all[current].src=Imgpath+imgName+'_def.gif';
}else if(document.layers){
document.layers[current].src=Imgpath+imgName+'_def.gif';
}
}
}
</script>
I wrote this JS for my webPage but;I couldnt make it work for Mozilla or Firefox and I couldn't find a proper solution.Can you help me about this?
I want to change my buttons images without refreshing the frame.But in Mozilla and Firefox document.getElementById() returns me "has no properties " error.What can i do for solving this problem and work my JS for them...
Thanks for Your consideration
Best Regards
<script language="JavaScript">
root="";
rootImg="";
var prevClicked = "";
var prevImagename ="";
Fullpath="Imgpath="../images/styleguide/";
function setRoot(rootId,rootImage)
{
root=rootId;
rootImg=rootImage;
}
function SwapImageMouseOver(current,imgName)
{
tmpStr2 = current.toString();
var source="";
if(document.getElementById){
source = document.getElementById(current).src.toString();
}else if(document.all)
{
source = document.all[current].src.toString();
}else if(document.layers)
{
source = document.layers[current].src.toString();
}
var controlsource=Fullpath+imgName+'_prs.gif';
if(source.toString() != controlsource.toString())
{
if(document.getElementById){
document.getElementById (current).src=Imgpath+imgName+'_ovr.gif';
}else if (document.all){
document.all[current].src=Imgpath+imgName+'_ovr.gif';
}else if(document.layers){
document.layers[current].src=Imgpath+imgName+'_ovr.gif';
}
}
}
function SwapImageMouseOut(current,imgName) {
tmpStr2 = current.toString();
var source = "";
var controlsource=Fullpath+imgName+'_prs.gif';
if(document.getElementById){
source = document.getElementById(current).src.toString();
}else if(document.all)
{
source = document.all[current].src.toString();
}else if(document.layers)
{
source = document.layers[current].src.toString();
}
if(source.toString() !=controlsource.toString())
{
if(document.getElementById){
document.getElementById (current).src=Imgpath+imgName+'_def.gif';
}else if (document.all){
document.all[current].src=Imgpath+imgName+'_def.gif';
}else if(document.layers){
document.layers[current].src=Imgpath+imgName+'_def.gif';
}
}
}
</script>