หน้า 1 จากทั้งหมด 1

ปัญหา Joomla 1.5 com_media upload Error Object doesn't support Javascript

โพสต์แล้ว: 08/03/2011 11:15 pm
โดย mindphp
เจอปัญหา
ปัญหา Joomla 1.5 com_media upload Error Object doesn't support Javascript
เพราะ ใช้ mootools 1.2.4 + Ajax ทำให้ มีผลกับ com_media กับ IE ที่ Frontpage

วิธีแก้ Object doesn't support
ต้องเขียน function ตอนที่คลิกรูปเพื่อใส่รูปลงใน text editor ใหม่
administrator\components\com_media\views\images\tmpl\dufault.php

โค้ด: เลือกทั้งหมด

// เพิ่ม function javascript นี้ลงไป
function insertImage(editor)
{
		extra = '';
		// Get the image tag field information
		var url					= document.getElementById("f_url").value; // $("f_url");
		var alt					= document.getElementById("f_alt").value;;	// $("f_alt");
		var align				= document.getElementById("f_align").value;;	 //$("f_align");
		var title				= document.getElementById("f_title").value;;	//$("f_title");
		var caption		= document.getElementById("f_title").value;;		// $("f_caption");
		
		if (url != '') {
			// Set alt attribute
			if (alt != '') {
				extra = extra + 'alt="'+alt+'" ';
			} else {
				extra = extra + 'alt="" ';
			}
			// Set align attribute
			if (align != '') {
				extra = extra + 'align="'+align+'" ';
			}
			// Set align attribute
			if (title != '') {
				extra = extra + 'title="'+title+'" ';
			}
			// Set align attribute
			if (caption != '') {
				extra = extra + 'class="caption" ';
			}

			var tag = "<img src=\""+url+"\" "+extra+"/>";
		}

		window.parent.jInsertEditorText(tag, editor);
		window.parent.document.getElementById('sbox-window').close();
		return false;

		}
แก้ไขปุ่ม insert เดิมด้วย function insertImage ที่เราสร้างขึ้นมาเองแทนจะได้ค่า

โค้ด: เลือกทั้งหมด

<button type="button" onclick="insertImage('<?php echo $_GET['e_name'];?>')"><?php echo JText::_('Insert') ?></button>