Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

   

Reply
 
LinkBack Thread Tools Display Modes
Old 10-17-2004, 05:22 AM   #1 (permalink)
Contributing Member
 
DragonEye's Avatar
 
Join Date: 10-13-03
Location: Belgium
Posts: 322
iTrader: 0 / 0%
Latest Blog:
None

DragonEye is liked by somebodyDragonEye is liked by somebodyDragonEye is liked by somebodyDragonEye is liked by somebodyDragonEye is liked by somebody
Send a message via MSN to DragonEye
Question Javascript: form text to bold onclick

hi,

I am currently making a site for a Belgian company and they want to be able to edit the content of their site through some kind of administration panel. I have created such a secured panel using PHP but I am having some problems to make a user friendly system for them to alter the site.

I have a form that that is filled out with the current text when they open it. The idea is that they can alter the text AND the layout of that text and there is my problem.

I would like them to be able to select text in a textarea field and when they click on the BOLD button the selected text should be bold immediately.

In the beta version of the system I'm using some phpBB-like system that adds (b) and (/b) around the selection but I would consider it more user friendly if I could lose the tags and let the selected form text go bold.

I have tried doing this with
document.selection.createRange().text.style.fontWe ight="bold" but that did not work

any ideas?

grtz

DragonEye
DragonEye is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-17-2004, 08:27 AM   #2 (permalink)
Moderator
 
LazyJim's Avatar
 
Join Date: 10-13-03
Location: UK
Posts: 2,821
iTrader: 0 / 0%
Latest Blog:
None

LazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to all
Send a message via MSN to LazyJim
textarea displays only plain-text as far as I know.
Best bet is to investigate making ordinary elements (like <div> and <p>) editable with browser-specific attributes like 'designmode' and 'contenteditable' (think I remembered them right :\ ).
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
LazyJim is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-17-2004, 08:31 AM   #3 (permalink)
Moderator
 
LazyJim's Avatar
 
Join Date: 10-13-03
Location: UK
Posts: 2,821
iTrader: 0 / 0%
Latest Blog:
None

LazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to all
Send a message via MSN to LazyJim
also a text-range object is not an actual part of the document, so giving it a style will not help. text ranges are just text, although IE will let you set the HTML of a range so you could wrap it in <stong> tags.

In fact if your clients agreed they would only use your editing system with IE your task would become a lot easier.
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
LazyJim is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ajax / Javascript Form Help adammc Coding Forum 3 06-01-2007 11:32 PM
How to create this Javascript form? ladan Coding Forum 5 01-23-2007 07:57 PM
Your recommended Form Field Validation Javascript bestempire Coding Forum 1 05-30-2006 08:18 AM
Javascript Form Validation Help ATLien Coding Forum 9 03-13-2006 01:36 PM
problem with tables and bold text Lorelei Coding Forum 1 05-08-2005 08:51 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 02:58 AM.
© Copyright 2008 V7 Inc