Slashman X

Posts: 54
Joined: 22 June 2007
|
Thursday, Oct 18, 2007 17:41
I'm using JS Quicktags for my text editor, i have it so when you open a tag, an "X" goes over the button for the open tag to close it. But i want to change that so it shows an image or at least a different span colour
RAW CODE function edAddTag(button) {
if (edButtons[button].tagEnd != '') {
edOpenTags[edOpenTags.length] = button;
document.getElementById(edButtons[button].id).value = 'X' + document.getElementById(edButtons[button].id).value;
}
}
function edRemoveTag(button) {
for (i = 0; i < edOpenTags.length; i++) {
if (edOpenTags[i] == button) {
edOpenTags.splice(i, 1);
document.getElementById(edButtons[button].id).value = document.getElementById(edButtons[button].id).value.replace('X', '');
}
}
}
You should see where i want to change it ('X')
Thanks
|
|
|
Jonny
Posts: 58
Joined: 22 June 2007
Location: Rochdale, England
|
Thursday, Oct 18, 2007 17:45
Can you not just change 'x' to something like: <img src="icon.png" /> ?
|
|
|
Slashman X

Posts: 54
Joined: 22 June 2007
|
Thursday, Oct 18, 2007 17:47
Jonny 
Can you not just change 'x' to something like: <img src="icon.png" /> ?
Tried that, it just showed <img .....>
Was wondering if theres any JS syntax that I'm doing wrong lol
|
|
|
PutzMan123

Posts: 396
Joined: 22 June 2007
Location: London, England
BabbleBoard Version: v1.1.5
|
Thursday, Oct 18, 2007 17:52
I remember how to do this........ Just, not now
|
|
|
Jonny
Posts: 58
Joined: 22 June 2007
Location: Rochdale, England
|
Thursday, Oct 18, 2007 17:57
Hmm, have you tried using double quotes around <img .. />?
Edit - Doubt this'll work, but i think you need something like this:
RAW CODE function edAddTag(button) {
var img = '<img src="kjhfjk" />';
if (edButtons[button].tagEnd != '') {
edOpenTags[edOpenTags.length] = button;
document.getElementById(edButtons[button].id).value = img + document.getElementById(edButtons[button].id).value;
}
}
Last edited by: Jonny
- Thursday, Oct 18, 2007 18:03.
|
|
|
Slashman X

Posts: 54
Joined: 22 June 2007
|
Thursday, Oct 18, 2007 18:06
Jonny 
Hmm, have you tried using double quotes around <img .. />?
Edit - Doubt this'll work, but i think you need something like this:
RAW CODE function edAddTag(button) {
var img = '<img src="kjhfjk" />';
if (edButtons[button].tagEnd != '') {
edOpenTags[edOpenTags.length] = button;
document.getElementById(edButtons[button].id).value = img + document.getElementById(edButtons[button].id).value;
}
}
Tried that before i think, didn't work
|
|
|
jameselliot
Posts: 1
Joined: 02 April 2008
|
Wednesday, Apr 02, 2008 20:04
Use the innerHTML element:
RAW CODE document.getElementById(edButtons[button].id).InnerHTML = "<img src=" etc.....
|
|
|