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

Recommended Answers

All 2 Replies

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

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');
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.