BabbleBoard Support Forums
What Are YOU Babbling About?
Hello Guest!  |  Home  |  Search  |  Login  |  Register
Home | Web Development | Javascript Help
Javascript Help
Slashman X



Role

Posts: 54
Joined: 22 June 2007

Thursday, Oct 18, 2007 17:41  Trackback URL

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

Go To Top
Jonny




Posts: 58
Joined: 22 June 2007
Location: Rochdale, England
Thursday, Oct 18, 2007 17:45  Trackback URL

Can you not just change 'x' to something like: <img src="icon.png" /> ?

Go To Top
Slashman X



Role

Posts: 54
Joined: 22 June 2007

Thursday, Oct 18, 2007 17:47  Trackback URL

Jonny Trackback URL

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

Go To Top
PutzMan123



Role

Posts: 396
Joined: 22 June 2007
Location: London, England
BabbleBoard Version: v1.1.5

Thursday, Oct 18, 2007 17:52  Trackback URL

I remember how to do this........ Just, not now

Go To Top
Jonny




Posts: 58
Joined: 22 June 2007
Location: Rochdale, England
Thursday, Oct 18, 2007 17:57  Trackback URL

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.
Go To Top
Slashman X



Role

Posts: 54
Joined: 22 June 2007

Thursday, Oct 18, 2007 18:06  Trackback URL

Jonny Trackback URL

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

Go To Top
jameselliot




Posts: 1
Joined: 02 April 2008

Wednesday, Apr 02, 2008 20:04  Trackback URL

Use the innerHTML element:

RAW CODE
document.getElementById(edButtons[button].id).InnerHTML = "<img src=" etc.....


Go To Top
 
1 Guest(s), 0 Member(s) Viewing This Topic:
 
 
 
Powered by BabbleBoard v1.1.6
All Content © BabbleBoard Support Forums