MyBB Community Forums

Full Version: Javascript will not work.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm modifying this plugin file to use a external js file instead of hard-coded JavaScript.

The thing is, showing an alert will now work at all. I'm not very good with JavaScript.

Can someone take a look at the code?

This is what I mean (imageresizer_gd.js):
			if(imageresizer_gd_showwarning == 1)
			{
				var position = 'img[i]'
				if(imageresizer_gd_warningposition == 1)
				{
					position = 'img[i].nextSibling';
				}

				var parent = img[i].parentNode;
				var warning = document.createElement("div");
				var align = parent.getAttribute("style");
				var setalign = "";
				if(align == "text-align: center;" || align == "text-align: right;" ) {
				if(align == "text-align: center;") setalign = "center";
				if(align == "text-align: right;") setalign = "right";}
				warning.innerHTML = '<div class="' + imageresizer_gd_warningclass + '" style="width:' + imageresizer_gd_resizewidth + 'px;"><a href="+imgURL+ " target="_blank">' + imageresizer_gd_warningtext + '</a></div>';
				warning.setAttribute("align", setalign);
				parent.insertBefore(warning, position);
			}
Bumpy post~