SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
-
Aug 5, 2007, 13:00 #1
- Join Date
- Jul 2004
- Location
- Netherlands
- Posts
- 672
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
javascrript not working in ie and opera :(
It is working in firefox though.. but it is kinda hard for me to figure out what is wrong and IE and Opera do not have a nice debugger like Firebug and i don't know much javascript yet...
Code:<script type="text/javascript" src="/mech7/js/tiny_mce/tiny_mce.js"></script><script type="text/javascript"> tinyMCE.init({ mode : "none", plugins : "fullscreen,advimage,advlink,codeprotect", theme : "advanced", theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,hr,link,unlink,charmap,image,cleanup,fullscreen,code,|,styleselect,formatselect", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_path_location : "bottom", file_browser_callback : "ajaxfilemanager", content_css : "/mech7/css/editor.css", extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", theme_advanced_resize_horizontal : false, theme_advanced_resizing : true, apply_source_formatting : true, }); function ajaxfilemanager(field_name, url, type, win) { var ajaxfilemanagerurl = "../../../../js/tiny_mce/plugins/ajaxfilemanager/ajaxfilemanager.php"; switch (type) { case "image": ajaxfilemanagerurl += "?type=img"; break; case "media": ajaxfilemanagerurl += "?type=media"; break; case "flash": //for older versions of tinymce ajaxfilemanagerurl += "?type=media"; break; case "file": ajaxfilemanagerurl += "?type=files"; break; default: return false; } var fileBrowserWindow = new Array(); fileBrowserWindow["file"] = ajaxfilemanagerurl; fileBrowserWindow["title"] = "Ajax File Manager"; fileBrowserWindow["width"] = "782"; fileBrowserWindow["height"] = "540"; fileBrowserWindow["close_previous"] = "no"; tinyMCE.openWindow(fileBrowserWindow, { window : win, input : field_name, resizable : "yes", inline : "yes", editor_id : tinyMCE.getWindowArg("editor_id") }); return false; } function toggleEditor(id) { var elm = document.getElementById(id); if (tinyMCE.getInstanceById(id) == null) tinyMCE.execCommand('mceAddControl', false, id); else tinyMCE.execCommand('mceRemoveControl', false, id); }
html:
<label for="article">Article <a href="javascript:toggleEditor('articleTextarea');">(wysiwyg)</a></label>
<textarea name="data[Article][article]" rows="10" cols="20" id="articleTextarea"></textarea> </div>
JavaScript - http://localhost/mech7/admin/articles/add
Javascript URL thread: "javascript:toggleEditor('articleTextarea');"
Error:
name: ReferenceError
message: Statement on line 1: Reference to undefined variable: toggleEditor
Backtrace:
Line 1 of unknown script
toggleEditor("articleTextarea");Go visit my site :-D you know you want to ;-)
www.mech7.net
-
Aug 5, 2007, 14:58 #2
- Join Date
- Jul 2007
- Posts
- 345
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Try using an event handler rather than the javascript link.
<a href="#" onclick="toggleEditor('articleTextarea');">
-
Aug 6, 2007, 02:24 #3
- Join Date
- Jul 2004
- Location
- Netherlands
- Posts
- 672
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Does not work unfortunatly
Go visit my site :-D you know you want to ;-)
www.mech7.net
-
Aug 6, 2007, 05:08 #4
- Join Date
- Oct 2004
- Location
- Troy, Mi
- Posts
- 231
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Try getting rid of the extra comma at the end of your object argument for tinymce.init method:
apply_source_formatting : true, <----var me = null;
-
Aug 6, 2007, 05:37 #5
- Join Date
- Jul 2004
- Location
- Netherlands
- Posts
- 672
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks that seems to have solved the problem
(wish there was a proper debugger for these sorts of things
)
Go visit my site :-D you know you want to ;-)
www.mech7.net
Bookmarks