Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 9th, 2003, 01:40 PM
Registered User
 
Join Date: Jul 2003
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>
 
Old July 10th, 2003, 02:56 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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
 
Old July 10th, 2003, 10:52 AM
Registered User
 
Join Date: Jul 2003
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?
 
Old July 11th, 2003, 06:28 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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





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





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