Welcome to Dream.In.Code
Become an Expert!

Join 149,527 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,476 people online right now. Registration is fast and FREE... Join Now!




Random Quote

 
Reply to this topicStart new topic

Random Quote

Shalini.Khiani
23 Jun, 2007 - 10:23 PM
Post #1

New D.I.C Head
*

Joined: 23 Jun, 2007
Posts: 5


My Contributions
I downloaded a script to show random quotes.
i modified the script to show the file location and it works, but everytime i edit the quotes to another set of different quotes I'd like, it stops working. I did not change any ' and maintained allthe brackets intact. I also did not modify any part of the javascript curly braces etc.

this code goes into the html file of the body

CODE

<script language="JavaScript1.1" src="http://www.mp2.computerfirst.net/motivatequote.js">
</script>


i have made 2 files
www.mp2.computerfirst.net/life1.html (code works with original motivatequote.js file) Attached File  works.doc ( 30k ) Number of downloads: 28


www.mp2.computerfirst.net/living.html (code doesnt work - file reference is motivatequote1.js file) Attached File  doesntwork.doc ( 24k ) Number of downloads: 25


attaching 2 files, which is an exact copypaste of these 2 js files respectively.

Can you help me identify what am i doing wrong ?

thanks
Shalini
User is offlineProfile CardPM
+Quote Post

DilutedImage
RE: Random Quote
23 Jun, 2007 - 10:37 PM
Post #2

D.I.C Addict
Group Icon

Joined: 20 Nov, 2006
Posts: 643



Thanked: 6 times
Dream Kudos: 25
My Contributions
Everything works fine. Your links both work (they're pointed to the same JS file), as does the code in the attached DOC files. I copied your 'doesntwork' code into a JS file, and it worked perfectly. Perhaps you just typed the filename wrong, or forgot to upload your file?
User is offlineProfile CardPM
+Quote Post

Shalini.Khiani
RE: Random Quote
26 Jun, 2007 - 07:59 AM
Post #3

New D.I.C Head
*

Joined: 23 Jun, 2007
Posts: 5


My Contributions
QUOTE(DilutedImage @ 23 Jun, 2007 - 11:37 PM) *

Everything works fine. Your links both work (they're pointed to the same JS file), as does the code in the attached DOC files. I copied your 'doesntwork' code into a JS file, and it worked perfectly. Perhaps you just typed the filename wrong, or forgot to upload your file?



Thanks for the reply - you are right, if i only put 3 quotes it works fine, but when i put all the quotes i want it doesnt work again, i figured maybe there's a limitation of 30 quotes still it doesnt work. sending you the doesnt work file Attached File  doesntwork.doc ( 36k ) Number of downloads: 26
once again. I tried once again copying the exact text and uploaded the file to the website, it doesnt work. the link is www.mp2.computerfirst.net/living.html

User is offlineProfile CardPM
+Quote Post

DilutedImage
RE: Random Quote
26 Jun, 2007 - 01:19 PM
Post #4

D.I.C Addict
Group Icon

Joined: 20 Nov, 2006
Posts: 643



Thanked: 6 times
Dream Kudos: 25
My Contributions
It's not liking the line breaks within the quotation marks. quotes[7] and quotes[17] are the ones causing the error. Attached is a revised js file.

As for why it doesn't like them ... . I have no idea. biggrin.gif


Attached File(s)
Attached File  doesWork.js.zip ( 2.76k ) Number of downloads: 26
User is offlineProfile CardPM
+Quote Post

Shalini.Khiani
RE: Random Quote
27 Jun, 2007 - 09:28 PM
Post #5

New D.I.C Head
*

Joined: 23 Jun, 2007
Posts: 5


My Contributions
QUOTE(DilutedImage @ 26 Jun, 2007 - 02:19 PM) *

It's not liking the line breaks within the quotation marks. quotes[7] and quotes[17] are the ones causing the error. Attached is a revised js file.

As for why it doesn't like them ... . I have no idea. biggrin.gif


Thanks - it works. Appreciate it.
User is offlineProfile CardPM
+Quote Post

DilutedImage
RE: Random Quote
27 Jun, 2007 - 11:31 PM
Post #6

D.I.C Addict
Group Icon

Joined: 20 Nov, 2006
Posts: 643



Thanked: 6 times
Dream Kudos: 25
My Contributions
Happy to help. icon_up.gif

p.s. ...

To find the problem, I just commented out questions by placing "/*" before the first question and "*/" after the last question. I then moved the comment's start down a couple questions at a time, and tested. This allowed me to determine which questions were causing the JS to stop working, and pinpoint what the cause was.

This post has been edited by DilutedImage: 27 Jun, 2007 - 11:31 PM
User is offlineProfile CardPM
+Quote Post

Arbitrator
RE: Random Quote
28 Jun, 2007 - 09:03 PM
Post #7

D.I.C Regular
Group Icon

Joined: 26 Jan, 2005
Posts: 492



Thanked: 1 times
My Contributions
QUOTE(DilutedImage @ 26 Jun, 2007 - 04:19 PM) *
As for why it doesn't like them ... . I have no idea.
Line‐breaks within strings need to be escaped with the Reverse Solidus (\) character. An example is shown below.

CODE
var string = "This is a string.\
    It is broken over multiple lines.\
    See?";

User is offlineProfile CardPM
+Quote Post

DilutedImage
RE: Random Quote
29 Jun, 2007 - 11:30 AM
Post #8

D.I.C Addict
Group Icon

Joined: 20 Nov, 2006
Posts: 643



Thanked: 6 times
Dream Kudos: 25
My Contributions
Cool; thank you. icon_up.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 08:52PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month