473,320 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

why do both lines of code work?!

Hello,

I have 2 lines of code which are different but both work. I refer to
the 3rd line with the url in it. In the first case the // are not
escaped, in the second they are.

Either

soundManager.createSound({
id:'mySound'+t,
url:'http://www.site.com/files/Track' + (+t+35) + '.mp3',
onfinish:function(){document.getElementById('test' +t+1).className =
'visibleDiv2'} });
soundManager.play('mySound'+t);
count++;

Or

soundManager.createSound({
id:'mySound'+t,
url:'http:\/\/www.site.com/files/Track' + (+t+35) + '.mp3',
onfinish:function(){document.getElementById('test' +t+1).className =
'visibleDiv2'} });
soundManager.play('mySound'+t);
count++;

The only difference as far as I can see is that with the

url:'http://www.site.com/files/Track' + (+t+35) + '.mp3',

the part after http: to the end of the line is grayed out with
Homesite (my html editor) whereas with

url:'http:\/\/www.site.com/files/Track' + (+t+35) + '.mp3',

it is not.

Is there any other difference?! I am used to the idea of escaping
various characters but usually the "\" is required for the code to
work.

Cheers

Geoff
Jun 27 '08 #1
2 1073
Geoff Cox meinte:
Is there any other difference?! I am used to the idea of escaping
various characters but usually the "\" is required for the code to
work.
No. / don't need to be escaped. You can, however - as you noticed it
won't have any effect, except worsening the readability. Masking is
needed though, when working with regular expressions.

Gregor
--
http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie
http://web.gregorkofler.com ::: meine JS-Spielwiese
http://www.image2d.com ::: Bildagentur für den alpinen Raum
Jun 27 '08 #2
On Wed, 07 May 2008 11:17:20 +0200, Gregor Kofler
<us****@gregorkofler.atwrote:
>Geoff Cox meinte:
>Is there any other difference?! I am used to the idea of escaping
various characters but usually the "\" is required for the code to
work.

No. / don't need to be escaped. You can, however - as you noticed it
won't have any effect, except worsening the readability. Masking is
needed though, when working with regular expressions.

Gregor
Thank Gregor - feel better now!

Cheers

Geoff
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: news | last post by:
Before I begin, I realise there's a big war regarding HTML in e-mails. Personally, I don't like it. Unfortunately, I'm being paid by my company to create an automated newsletter for our customers....
17
by: Douglas Alan | last post by:
Is there a canonical way of iterating over the lines of a file that are null-separated rather than newline-separated? Sure, I can implement my own iterator using read() and split(), etc., but...
9
by: davetelling | last post by:
I am not a programmer, I'm an engineer trying to make an interface to a product I'm designing. I have used C# to make a form that interrogates the unit via the serial port and receives the data. I...
4
by: Gari | last post by:
Dear All, I’ve been using this forum since three weeks now and I always had the answer to my questions. So this encourages me to use it again but I hope I am not annoying anybody. I am trying...
3
by: ckirchho | last post by:
Hallo, my task is to establish some kind of full text file search in Javascript. The files and it's contents are fixed, the HTML/JavaScript pages lie offline on a server. As far as Javascript...
19
by: Pavan | last post by:
Hi, I want to know if there is any software for measuring lines of code of my c++ application. I found out a tool, sloccount, but it gives only physical lines of code. I found out one more...
9
by: Alexander Dong Back Kim | last post by:
Dear all, I'm doing an experimental thing that the codes I wrote can be compiled by both VS2005 and gcc. I saw somewhere on the web that I can use compiler's pre-defined value something life...
4
by: Curious | last post by:
I have a file to which I'll need to at first read until it locates the last line of string. According to content of the last line of string, I'll need to write something to this file right after...
4
by: BibI | last post by:
Hi there, I just started programming with PERL and am trying to put together my first little data manipulation program. I am working on a MAC with OSX. I have a data file with the following...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.