Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 9th, 2003, 01:40 PM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Javascript - Undetermined String Errors

This script carrys on returning Undertermined String Errors left right and center can anybody tell me whats wrong with it?

<script>

var Board1 = new Array("warts School","Great Hall","Archive","Classrooms","Dumbeldores Office","Gryffinder House Common Room","House Quidditch","Harry Potter and the Order of the Phoenix","House Quidditch","Hufflepuff House Common Room","Ravenclaw House Common Room","Slytherin House Common Room","Staff Room","The Dungeons","The Films","The Forbidden Forest","The Hospital Wing","The Kitchens","").join(",");
var Board2 = new Array("smeade Village","Gladrags Wizarding Gear","Honeydukes Sweet Shop","The Post Office","The Shreiking Shack","The Three Broomsticks","Zonkos Joke Shop","").join(",");
var Board3 = new Array("gon Alley","Daily Prophet Studios","Divine Divination Store","Eyelops Owl Emporium","Florean Fortescues's Ice Cream Parlour","Flourish & Blotts","Madam Malkins Robes","Magical Menagerie","Ollivanders","Quality Quidditch Supplies","The Apothecary","The Leaky Cauldren","").join(",");
var Board4 = new Array("ckturn Alley","Borgin & Burkes","Posions & Potions","Rare Supplies","Darker Distractions","").join(",");
var Board5 = new Array("ngotts Bank","Entrance Hall","Depositing Desk","Subscriptions Desk","Underground Vaults","").join(",");
var Board6 = new Array("arding World","Your Home","Quidditch Games","").join(",");
var Board7 = new Array("tform 93/4","Platform 93/4","Kings Cross Station","The Hogwarts Express Train","").join(",");
var Board8 = new Array("istry of Magic","Telephone Box","Atrium","Level Seven","Level Six","Level Five","Level Four","Level Three","Level Two","Level One","").join(",");
</script>

<table border=1 cellspacing=0 cellpadding=0>
<tr>
<td>
<table border=0 cellpadding=2>
<tr>
<td colspan=3 align=center></td>
</tr>
<tr>
<th class="head">Message area</th>
<th class="head"># of posts</th>
<th class="head">Last updated</th>
</tr>
<tr><th colspan=3 align=center><a name="Area1">Hogwarts School</a></th></tr>

<script>
[loop:areas]
if (Board1.indexOf("[name]",0) >= 0){
document.write('[if:read_allowed]');
document.write('<tr>');
document.write('<td class="[alternating]"><a href="[url]" class="visit">');
document.write("[name]");
document.write('</a>');
document.write('[if:text]');
document.write("<br>[text]");
document.write('[endif:text]');
document.write('</td>');
document.write('<td class="[alternating]">[posts]</td>');
document.write('<td class="[alternating]">[last_update]</td>');
document.write('</tr>');
document.write('[endif:read_allowed]');
}
[endloop:areas]
</script>
<tr><td colspan=3>&nbsp;</td></tr>

<tr><th colspan=3 align=center><a name="Area2">Hogsmeade Village</a></th></tr>

<script>
[loop:areas]
if (Board2.indexOf("[name]",0) >= 0){
document.write('[if:read_allowed]');
document.write('<tr>');
document.write('<td class="[alternating]"><a href="[url]" class="visit">');
document.write("[name]");
document.write('</a>');
document.write('[if:text]');
document.write("<br>[text]");
document.write('[endif:text]');
document.write('</td>');
document.write('<td class="[alternating]">[posts]</td>');
document.write('<td class="[alternating]">[last_update]</td>');
document.write('</tr>');
document.write('[endif:read_allowed]');
}
[endloop:areas]
</script>
<tr><td colspan=3>&nbsp;</td></tr>

<tr><th colspan=3 align=center><a name="Area3">Diagon Alley</a></th></tr>

<script>
[loop:areas]
if (Board3.indexOf("[name]",0) >= 0){
document.write('[if:read_allowed]');
document.write('<tr>');
document.write('<td class="[alternating]"><a href="[url]" class="visit">');
document.write("[name]");
document.write('</a>');
document.write('[if:text]');
document.write("<br>[text]");
document.write('[endif:text]');
document.write('</td>');
document.write('<td class="[alternating]">[posts]</td>');
document.write('<td class="[alternating]">[last_update]</td>');
document.write('</tr>');
document.write('[endif:read_allowed]');
}
[endloop:areas]
</script>
<tr><td colspan=3>&nbsp;</td></tr>

<tr><th colspan=3 align=center><a name="Area4">Knockturn Alley</a></th></tr>

<script>
[loop:areas]
if (Board4.indexOf("[name]",0) >= 0){
document.write('[if:read_allowed]');
document.write('<tr>');
document.write('<td class="[alternating]"><a href="[url]" class="visit">');
document.write("[name]");
document.write('</a>');
document.write('[if:text]');
document.write("<br>[text]");
document.write('[endif:text]');
document.write('</td>');
document.write('<td class="[alternating]">[posts]</td>');
document.write('<td class="[alternating]">[last_update]</td>');
document.write('</tr>');
document.write('[endif:read_allowed]');
}
[endloop:areas]
</script>
<tr><td colspan=3>&nbsp;</td></tr>

<tr><th colspan=3 align=center><a name="Area5">Gringotts Bank</a></th></tr>

<script>
[loop:areas]
if (Board5.indexOf("[name]",0) >= 0){
document.write('[if:read_allowed]');
document.write('<tr>');
document.write('<td class="[alternating]"><a href="[url]" class="visit">');
document.write("[name]");
document.write('</a>');
document.write('[if:text]');
document.write("<br>[text]");
document.write('[endif:text]');
document.write('</td>');
document.write('<td class="[alternating]">[posts]</td>');
document.write('<td class="[alternating]">[last_update]</td>');
document.write('</tr>');
document.write('[endif:read_allowed]');
}
[endloop:areas]
</script>
<tr><td colspan=3>&nbsp;</td></tr>

<tr><th colspan=3 align=center><a name="Area6">Wizarding World</a></th></tr>

<script>
[loop:areas]
if (Board6.indexOf("[name]",0) >= 0){
document.write('[if:read_allowed]');
document.write('<tr>');
document.write('<td class="[alternating]"><a href="[url]" class="visit">');
document.write("[name]");
document.write('</a>');
document.write('[if:text]');
document.write("<br>[text]");
document.write('[endif:text]');
document.write('</td>');
document.write('<td class="[alternating]">[posts]</td>');
document.write('<td class="[alternating]">[last_update]</td>');
document.write('</tr>');
document.write('[endif:read_allowed]');
}
[endloop:areas]
</script>
<tr><td colspan=3>&nbsp;</td></tr>

<tr><th colspan=3 align=center><a name="Area7">Platform 93/4</a></th></tr>

<script>
[loop:areas]
if (Board7.indexOf("[name]",0) >= 0){
document.write('[if:read_allowed]');
document.write('<tr>');
document.write('<td class="[alternating]"><a href="[url]" class="visit">');
document.write("[name]");
document.write('</a>');
document.write('[if:text]');
document.write("<br>[text]");
document.write('[endif:text]');
document.write('</td>');
document.write('<td class="[alternating]">[posts]</td>');
document.write('<td class="[alternating]">[last_update]</td>');
document.write('</tr>');
document.write('[endif:read_allowed]');
}
[endloop:areas]
</script>
<tr><td colspan=3>&nbsp;</td></tr>

<tr><th colspan=3 align=center><a name="Area8">Ministry of Magic</a></th></tr>

<script>
[loop:areas]
if (Board8.indexOf("[name]",0) >= 0){
document.write('[if:read_allowed]');
document.write('<tr>');
document.write('<td class="[alternating]"><a href="[url]" class="visit">');
document.write("[name]");
document.write('</a>');
document.write('[if:text]');
document.write("<br>[text]");
document.write('[endif:text]');
document.write('</td>');
document.write('<td class="[alternating]">[posts]</td>');
document.write('<td class="[alternating]">[last_update]</td>');
document.write('</tr>');
document.write('[endif:read_allowed]');
}
[endloop:areas]
</script>
</table>
</td>
</tr>
</table>
Reply With Quote
  #2 (permalink)  
Old July 10th, 2003, 02:56 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well it's hard to tell because we can't see where the line breaks are. You can't split a string over a line like:
"Hello
World"
Other than that you should get a line number for the error and try splitting it up into more manageable chunks, it would be a true altruist who combed through all that code.


--

Joe
Reply With Quote
  #3 (permalink)  
Old July 10th, 2003, 10:52 AM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well what does the error Undertermined String Error come from? Obviousley a undertermined string error but what exactly will cause this?
Reply With Quote
  #4 (permalink)  
Old July 11th, 2003, 06:28 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

It's because one of your strings does not have closing quotation marks. It's "Unterminated string constant".

--

Joe
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validator controls throwing JavaScript errors Bob Bedell ASP.NET 2.0 Professional 7 December 31st, 2007 06:05 AM
Javascript Errors Not Appearing itHighway Javascript How-To 1 October 13th, 2005 01:30 AM
XSLT + Javascript errors braindog_43 XSLT 0 February 3rd, 2005 09:04 AM



All times are GMT -4. The time now is 09:35 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.