Javascript not working
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #1
Javascript not working
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):

Javascript Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
			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);
			}



Attached File(s)
.php  class_imageresizer_gd.php (Size: 11.07 KB / Downloads: 403)
.js  imageresizer_gd.js (Size: 1.48 KB / Downloads: 398)
.php  imageresizer_gd.php (Size: 7.46 KB / Downloads: 369)

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
07-09-2012 09:26 AM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Javascript not working - Sama34 - 07-09-2012 09:26 AM
RE: Javascript not working - ZiNgA BuRgA - 07-10-2012, 07:30 PM
RE: Javascript not working - Sama34 - 07-11-2012, 08:46 AM
RE: Javascript not working - ZiNgA BuRgA - 07-11-2012, 10:16 PM
RE: Javascript not working - Sama34 - 07-15-2012, 01:42 AM
RE: Javascript not working - ZiNgA BuRgA - 07-15-2012, 09:36 AM
RE: Javascript not working - Sama34 - 07-15-2012, 11:16 AM
RE: Javascript not working - ZiNgA BuRgA - 07-15-2012, 04:36 PM

 Standard Tools
Forum Jump: