page commitment menu search

script escape characters

Home Products Web design Publications Advertising Graphics Free Quotation
 
Quick Links
Dycept RSS Feeds

Tutorials - Dycept now provide free tutorials to help solve all your Internet needs

WebDesign - Taylored web site solutions for any businesses needs

Advertising - Exciting opportunities for advertising your site at affordable prices

rss

News Headlines

Economy boost may mean pain later - Alistair Darling may be forced to set out future taxes rises to pay for a short-term boost to the economy, the BBC understands.

Johnson ponders immigrant amnesty - The Mayor of London is to commission a study of a potential amnesty for illegal immigrants in the capital.

Clinton 'will accept State post' - Hillary Clinton will agree to serve as secretary of state under US President-elect Barack Obama, the New York Times reports.

Florida boy's suicide live on web - A Florida teenager commits suicide in front of a webcam streaming live video

'No justification' for Brand show - Lewd calls from Russell Brand and Jonathan Ross to actor Andrew Sachs had "no editorial justification", the BBC Trust says.

Problem:

Most internet programming requires scripts to produce dynamic interactive data. At some point you will need to send a string as a variable 'David is at work' which is fine but what happens when you need to use a hyphen in the sentence e.g. 'David's working' as you can see in a script the string is 'David' and the rest will cause an error.

Solution:

Well if your script allows it you could use "" quotes with ' inside

"David's working"

However there are lots of occasions where this wont work like in JavaScript when your calling a function on an event in which case you will need to use the escape character \

'David\'s working'

The backslash tells the script that the following character is meant to be displayed and not part of the script.

Example:

This will open up an alert window with David's working in it.

<img src="button.jpg" onclick="javascript:window.alert('David\'s working');">

Best, David Batey.

Back | Order