PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Graphisme & Infographie > macromedia.dreamweaver > javascript htmlencode/decode?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
javascript htmlencode/decode?

Réponse
 
LinkBack Outils de la discussion
Vieux 10/04/2008, 16h33   #1
darrel
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut javascript htmlencode/decode?

I have a function that will insert HTML into a text editor box. It'll look
like this:

editor.insert('my string')

The problem is if mystring has characterts that need to be escaped. ie:

editor.insert('<a href="link">I can't run as well as 'Mr. Mike'. I'm tired
and said "you go without me, mike!"</a>')

The bigger catch is that these strings are going to be rather huge, as they
are giant chunks of HTML (big tables, etc.)

It doesn't look like javascript offers a htmlencode/decode function but does
thave the escape/unescape.

unescape would work fine provided I 'escape' my string first. Anyone know of
a tool, downloadable or online that I can paste in text and have it escaped
for me for use in a javascript?

-Darrel


  Réponse avec citation
Vieux 10/04/2008, 16h43   #2
darrel
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: javascript htmlencode/decode?

> unescape would work fine provided I 'escape' my string first. Anyone know
> of a tool, downloadable or online that I can paste in text and have it
> escaped for me for use in a javascript?


Or, perhaps a different way to solve this...

If I have this string: &lt;table id=&quot;gatewaytable&quot;&lt;

Is there a prebuilt function in javascript to 'unencode' the html entities
so it inserts this:

<table id="gatewaytable">

Or would one have to write their own script to manually replace the html
entities?

-Darrel


  Réponse avec citation
Vieux 10/04/2008, 16h48   #3
darrel
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: javascript htmlencode/decode?


>Anyone know of
> a tool, downloadable or online that I can paste in text and have it
> escaped for me for use in a javascript?


Spoke too soon. Found one:

http://www.the-art-of-web.com/javascript/escape/

-Darrel


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 06h44.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,07126 seconds with 11 queries