Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript 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 January 18th, 2007, 06:07 AM
Registered User
 
Join Date: Jan 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Unterminated String constant

I get the "Unterminated String Constant" error at line 8.
Please help...I am unable to figure what is wrong.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<script type="text/javascript">
var obj =
{
init : function()
{
    obj.q = document.getElementById('q');
    obj.b = document.getElementById('b');
    obj.r = document.getElementById('r');
    obj.b.onclick = obj.pingSearch;
},
pingSearch : function()
{
    if (obj.q.value)
    {
     obj.s = document.createElement('script');
     obj.s.type ='text/javascript';
     obj.s.charset ='utf-8';

obj.s.src =
'http://answers.yahooapis.com/AnswersService/V1/questionSearch?appid=blahblah&output=json&callback =obj.pongSearch&query=cars';
     document.getElementsByTagName('head')[0].appendChild(obj.s);
    }
},
pongSearch : function(z)
{
    obj.r.innerHTML = '';
    alert('ans'+z.ResultSet.Question.length);
    for (var i = 0; i < z.ResultSet.Question.length; i++)
    {
     var li = document.createElement('li');
     var a = document.createElement('a');
     a.href = z.ResultSet.Question[i].Link;
     a.innerHTML = z.ResultSet.Question[i].Subject;
     li.appendChild(a);
         obj.r.appendChild(li);
    }
},
pongSearch1 : function(z)
{
    obj.r.innerHTML = '';
    alert('web'+z.ResultSet.Result.length);
    for (var i = 0; i < z.ResultSet.Result.length; i++)
     {
     var li = document.createElement('li');
     var a = document.createElement('a');
     a.href = z.ResultSet.Result[i].Url;
     a.innerHTML = z.ResultSet.Result[i].Title;
     li.appendChild(a);
         obj.r.appendChild(li);
         }
     }
};
window.onload = function()
{
    obj.init();
};
</script>


</head>
<body>

<br><br>
<input id="q">
<button id="b">Search</button>

<ul id="r"></ul>
</body>
</html>
 
Old February 11th, 2007, 09:45 PM
Friend of Wrox
 
Join Date: Nov 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thats odd i dont get that error on both IE and Firefox.

maybe you should try
Code:
var obj ={
instead of
Code:
var obj =
{
__________________________________________________ ________
I am DJ Kat...that's my name. Its a D and a J and a Kat with a K.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Unterminated string constant cnottingham Classic ASP Databases 8 October 28th, 2011 01:43 PM
Unterminated String Constant Apocolypse2005 Javascript 2 June 22nd, 2006 08:36 AM
unterminated string constant Stubby HTML Code Clinic 1 February 3rd, 2005 05:56 AM
Unterminated String Constant Ben Horne Javascript 7 October 21st, 2004 11:26 AM
Unterminated String Constant Ben Horne Javascript 2 April 9th, 2004 02:26 PM





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