0

Hi,

This piece of code works in chrome & IE but not Firefox, can anyone see why?

function openimage(a, b, c, d) {
    var b = document.getElementById('photo' + a).value;
    var c = document.getElementById('album' + a).value;
    var d = document.getElementById('clicks' + a).value;

    if (d = 1) {
        jQuery.facebox({
            ajax: 'profile/previewphoto.inc.php?photo=' + b + '&album=' + c + ' '
        })
            document.getElementById('clicks' + a).value = '2';
        setTimeout('setitback(' + a + ')', 1500);
    }
}
function setitback(a) {
    document.getElementById('clicks' + a).value = '1';
}

Thanks in advance

Wayne

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Waynef
0

Wayne,

This would make better use of jQuery, and may also fix the problem:

function openimage(a) {
	var b = jQuery('#photo' + a);
	var c = jQuery('#album' + a);
	var d = jQuery('#clicks' + a);
	if(d.val() == '1') { // == not =
		jQuery.facebox({
			ajax: 'profile/previewphoto.inc.php?photo=' + b.val() + '&album=' + c.val() + ' ';
		});
		d.val('2');
		setTimeout(function(){d.val('1');}, 1500);
	}
}

Airshow

0

Hi airshow,

With a little tweaking i got your code to work, thanks for the pointers

function openimage(a) {
    var b = $("#photo" + a).val();
    var c = $("#album" + a).val();
    var d = $("#clicks" + a).val();

    if (d == '1') {
        jQuery.facebox({
            ajax: 'profile/previewphoto.inc.php?photo=' + b + '&album=' + c + ' '
        })
            $("#clicks" + a).val('2');
        setTimeout('setitback(' + a + ')', 1500);
    }
}

function setitback(a) {
    $("#clicks" + a).val('1');
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.