The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
I need a way to have a Javascript function append text to the vbulletin editors textarea when posting a new thread/post. I have written a custom image upload script for my forum that is used during new posts, it allows a member to select an image, upload it to the server and then provides a reference to the image in the form of a link, what I have tried to do is write a javascript function that will take the link and format a string with bb IMG tags, and then append the string to the VB Editor textarea, however when i reference the textarea by id in javascript, using getElementsById('VB_Editor_001_textarea') and subsequently try to append a string to the value property of the element, i receive this error in firefox:
Code:
Error: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMNSHTMLDocument.queryCommandState]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: http://orlounge.com/forum/clientscript/vbulletin_textedit.js?v=364 :: anonymous :: line 1415" data: no] Source File: http://orlounge.com/forum/clientscript/vbulletin_textedit.js?v=364 Line: 1415 |
#2
|
|||
|
|||
![]()
Try it:
window.frames['vB_Editor_001_iframe'].document.body.innerHTML Work only with Internet Explorer. If you know how to do to work in other browser please share info here. |
#3
|
|||
|
|||
![]()
ohhhh I found the solution:
Code:
document.getElementById('vB_Editor_001_iframe').contentWindow.document.body.innerHTML |
#4
|
||||
|
||||
![]()
use the vb javascript function
fetch_object('vB_Editor_001_iframe').innerHTML = 'whatever'; it takes care of browser compatibility for you ![]() |
#5
|
|||
|
|||
![]()
Your solution doesn't work. Try it:
<input type="button" name="test" value="test" onClick="fetch_object('vB_Editor_001_iframe').inne rHTML = 'whatever';"> |
#6
|
|||
|
|||
![]()
i actually found a different way, using one of the functions from the text editor itself, the function:
Code:
vB_Editor['vB_Editor_001'].insert_text(text) |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|