I am throughly confused....why does this seemingly simple deal not work?

<script type="text/javascript">
<!--
window.onbeforeunload = function (){
	var checkboxImg = new Image();
	var checkboxImgUrl = "checkbox.php%3Flonger%3D" + reviews-chk-longer.checked +
                    "%26discrete%3D" + reviews-chk-discrete.checked + 
                    "%26natural%3D" + reviews-chk-natural.checked +
                    "%26thicker%3D" + reviews-chk-thicker.checked +
					"%26permanent%3D" + reviews-chk-permanent.checked +
					"%26stamina%3D" + reviews-chk-stamina.checked +
					"%26harder%3D" + reviews-chk-harder.checked +
					"%26vascularity%3D" + reviews-chk-vascularity.checked +
					"%26drive%3D" + reviews-chk-drive.checked +
					"%26guarantee%3D" + reviews-chk-guarantee.checked +
					"%26trials%3D" + reviews-chk-trials.checked +
					"%26affordable%3D" + reviews-chk-affordable.checked;
	alert(checkboxImgUrl);
	checkboxImg.src = checkboxImgUrl;
}
// -->	
</script>

I get no alert when I do this....the same thing without all of the added strings works fine, ie:

<script type="text/javascript">
<!--
window.onbeforeunload = function (){
	var checkboxImg = new Image();
	var checkboxImgUrl = "checkbox.php";
	alert(checkboxImgUrl);
	checkboxImg.src = checkboxImgUrl;
}
// -->	
</script>

The alert pops just fine....what is up??? What am I missing?

I tried .concat the strings too...still same thing is happening...why?

Recommended Answers

All 5 Replies

Man what is up with DaniWeb???? 25 views and not even 1 reply....comeon!!!!

Someone??? Anyone???

Wow...so far...DaniWeb has been totally useless to me...almost 30 posts...and no help AT ALL!!! Even for something that is as simple as this!!!! Soooo frustrating!!!

I didn't bother to read this thread until now because it already already had 3 replies when I first saw it.

You shot yourself in the foot.

Thanks for the tip.

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.