SetTimeout() Syntax Convert Expression To Literal String?

Apr 16, 2011

<p> Howdy <p> expressed as a literal string that is passed to the setTimeout() function might look like this: setTimeout("document.getElementById('first').innerHTML = '<p>' + 'HOWDY' + '</p>';", 2000);

I guess you can't just put quotes around an expression like this: "'<p> HOWDY </p>;" So tags have to be isolated, but it get confusing with expressions like this, which I am not sure how to express as a string:

<p><h2 class="pos_left"> <img src="car1.jpg" name="slide" width="400" height="250" /> </h2> </p>

I wish I could change the " in there to ' and then just wrap the whole thing in double " This is what I came up with but it did not work: setTimeout("document.getElementById('first').innerHTML = '<p>' + '<h2' + 'class='pos_left'' + '>' + '<img' + 'src='car1.jpg'' + 'name='slide'' + 'width='400'' + 'height='250'' + '/>' + '</h2>' + '</p>';", 4000);

View 6 Replies


ADVERTISEMENT

JQuery :: Syntax Error,uncaught Exception: Syntax Error, Unrecognized Expression: [@href^="mailto:"]

Jun 6, 2010

i'm a newbie on jquery i'm studying it with the latest version, and following a book called "Learning Jquery" but iencountered a error, and i don't know what the problem is:

i copied the code from the book like this:$('a[@href^="mailto:"]').addClass('mailto'); to try to change the links which start with "mailto" to the new class "mailto" but there's a error reported: uncaught exception: Syntax error, unrecognized expression: [@href^="mailto:"]

View 5 Replies View Related

SetTimeout() Syntax, Where Do Quotes Go

Apr 15, 2011

I am just learning the basics and am trying to figure out timing with setTimeout()

<script type="text/javascript">
document.write("<p>" + Date() + "</p>");
setTimeout("document.write('Hello There World');", 2000);
setTimeout("document.write("<p>" + Date() + "</p>");", 2000);
</script>

the 1st document.write works and the 1st setTimeout() works, but then I add the fourth line and the page will not load.

Why does it not like my 4th line : "setTimeout("document.write("<p>" + Date() + "</p>");", 2000);"?

View 6 Replies View Related

Replace String Literal

Jun 6, 2006

How would one make the ECMA-262 String.replace method work with a
string literal?

For example, if my string was "HELLO[WORLD]" how would I make it work
in this instance.

Please note my square brackets are not regular expression syntax.

View 21 Replies View Related

Parameterizing A String Literal

Mar 16, 2007

A section of my webpage consists of two dozen lines of text displayed
by sequentially calling:

function printText1( text )
{
document.getElementById( "textLine1" ).innerHTML = text;
}
....
function printText24( text )
{
document.getElementById( "textLine24" ).innerHTML = text;
}

Is there a way to parameterize the string literal (textLineXX) so that
I can do it all by repeatedly calling one printText function?

View 7 Replies View Related

Unterminated String Literal

Jan 25, 2006

im trying to read an xml file and put it into a textarea on my page.
here is the code that returns the xml file as a string:

Document doc = new Document();
SAXBuilder saxBuilder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
XMLOutputter xmlOut = new XMLOutputter(Format.getPrettyFormat());
doc = saxBuilder.build(filesName);
String xml = outputter.outputString(doc);

no when i try to pass this to a javascript as follows:
function putXML(fileName){
var blah = '<%= xml %>'
document.btraxtestForm.HighwayMessage.innerText=blah;
}

it gives me a unterminated string literal error.

also, i will never know the contents of this xml file so i cant split up the string.
has anyone any ideas how i will fix this?

View 5 Replies View Related

JQuery :: Uncaught Syntax Error, Unrecognized Expression: # After Upgrading To 1.5?

Feb 1, 2011

I'm not actually sure that this issue was developed as I upgraded to jQuery 1.5, but it was very much around that time. I packaged my testcase and attatched it to the post. The fallowing error is caught in the JavaScript console when the Ć–ppna Alla button is pressed on the site:

[Code]...

View 1 Replies View Related

Error: Unterminated String Literal

Jan 24, 2009

Error: unterminated string literal

on this line?

document.getElementById('id_company').innerHTML = '<span class="textGreen"><strong>news</strong></span>';

View 1 Replies View Related

Unterminated String Literal From Paste?

Jun 30, 2011

I created a simple WYSIWYG for creating CSS based webpages. It works exactly as assumed in Safari and Chrome. However, in firefox, when you copy/paste more than one line of text, instead of formatting it as html, in puts in line breaks causing the array storing all of the data to break into multiple lines and causing an unterminated string literal.

1. suggest why it is behaving this way?
2. suggest a work around to allow it to work on FF?

View 2 Replies View Related

Getting Unterminated String Literal Error?

Oct 8, 2011

i am getting this error " unterminated string literal" but iam unable to locate the problem..iam using fire bug for firefox..

View 6 Replies View Related

Strange Unterminated String Literal Error

Dec 22, 2007

I can't find anything wrong with this code <!-- Initialise the editor --><script>
initRTE('<table align="" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr></tr></tbody></table>', 'example.css');
</script>

However this throws an error in firebug and the page doesn't display it correctly, i get an error in firebug

unterminated string literal
initRTE('<table align="" border="0" cellpadding="0" cellspacing="0" widt...
Does anyone have and idea whats going on?

View 16 Replies View Related

Error - Unterminated String Literal SelectAndUpdate('EA13','GY','210/60R

Aug 18, 2011

I am setting dynamically a function call in my php as like this

onClick=selectAndUpdate('".$row1[serialNo]."','".$row1[bC]."','".$row1[size]."','".$row1[pattern]."');

Then when I run I get this error unterminated string literal selectAndUpdate('EA13','GY','210/60R. That means my third value from the db got problem due to the slash right? How to overcome this?

View 7 Replies View Related

Convert String Into Array - Break Apart A String Into Characters

Jan 27, 2010

Is it possible to break apart a string into characters, be it a word or a sentence, and store each individual character in an array?

View 11 Replies View Related

JQuery :: Un-terminated String Literal (creating A Script Tag) [uploadify]?

Dec 23, 2011

I am trying to create 3 elements on the fly when a button is clicked. The button is the show an upload form for images. I am using uploadify (first time using it) and I have several different upload type/options for them so I am sending id's to differentiate between them. The problem I am having is when trying to create the script tag which in turn controls the input file type tag, and it is baffling me. Here's the code first:

[Code]...

View 1 Replies View Related

Ajax - Create An XMLHttpRequest Object But Getting A Syntax Error "missing } XML Expression (on Column 56)"

Feb 14, 2010

I'm try to create an XMLHttpRequest object but getting a syntax error with this code:

var XMLHttpRequest;
try{
XMLHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}

syntax error: missing } XML expression (on column 56)

View 2 Replies View Related

Get Rid Of HTML Syntax In A String?

Jun 28, 2011

I'm trying to get rid of HTML syntax in a string - that is, anything between < > brackets, including the < > brackets, I want to remove. So I tried this, but I'm probably not doing it right..

var myNewString = info.replace(/<[.]>/g, "");

View 2 Replies View Related

Append A Query String To A SetTimeout?

Jun 8, 2011

I can append a query string to a setTimeout?So i have this:PHP Code: setTimeout("location.hrefĀ = 'http://www.natural-environment.com';",1500); and i want to do this:PHP Code:var Email ="foo"; setTimeout("location.href = 'http://www.natural-environment.com?Email=+Emai+';",1500); 

View 2 Replies View Related

Convert Into To String?

Dec 16, 2002

im just starting to learn Javascript, and am wondering if there is anyway I can take an int and convert it into a string... ?

View 3 Replies View Related

JQuery :: Extrac String From A Given Expression?

Apr 15, 2011

Is there an available function in jQuery that would let me extract certain string of characters in a given expression, say I have the expression "2|23|6|niece", i wanted to extract 2,23,6 and niece from the given expresion and assign each in a variable leaving the (" | ") character

View 3 Replies View Related

Perform A Regular Expression On A String?

Sep 8, 2009

I would like to perform a regular expression on a string and if TRUE do something.

I have huge amounts of knowledge doing this in PHP but trying out javascript.

View 1 Replies View Related

Searching For String Starting With Expression?

Nov 29, 2009

I'm having a bit of trouble with javascript... I'm searching for a string that starts with another string

code:
for (x in products ){
s = products[x].id.toString(10);
v = "/";

[Code]....

the variables are integers but since i'm searching for the beginning only i turned them into strings...

the problem occurs when I add the  it turns out gibberish..

p.s. if there is a faster way to do it without turning the variables to string also would be great to know.

View 1 Replies View Related

Possible To Get Price From A String Using Regular Expression?

Aug 31, 2009

How can I get price from a string using regular expression ? Or by any other means .

Let's say. var str="Our shop receives only $. This shoe costs $200. We don't accept anything else then $"; ow could I retrieve '$200' from this above string. By any means.

View 3 Replies View Related

Regular Expression As String Argument?

Feb 24, 2006

I'm finishing my javascript form validator (only text fields for now) and here's one of the last things that's left.

I'm using class names of input elements as parameters for my validator. To find them i use Element.hasClassName(id, class) method from prototype library. I want to implement minlength parameter - so i grab a regexp tutorial and after a minute i had something like this minlength[[1-9][0-9]*], which finds minlength[1], minlength[666] and so on.

Great, but how to pass this as a paramter to hasClassName method, which requires string as a className?

View 2 Replies View Related

Regular Expression :: String Must Have [a-z] [0-9] In Any Order

Oct 30, 2002

My continuing problem with regular expressions! All I am trying to get is the expression must have at least 1 of these [a-z][0-9] in any order etc etc

RegExp(/[a-z][0-9]/)
didn't work

View 4 Replies View Related

Get Price From A String Using Regular Expression?

Sep 1, 2009

How can I get price from a string using regular expression? Or by any other means .

var str="Our shop receives only $. This shoe costs $200. We don't accept anything else then $";

How could I retrieve '$200' from this above string. By any means.

View 5 Replies View Related

XSL Stylesheet For XML - Getting Error Message" A String Literal Was Expected, But No Opening Quote Character Was Found"?

May 14, 2011

I'm supposed to generate an XHTML table using the following data:

<CLASS ID=ā€¯Advanced Web Developmentā€¯>
<STUDENT>
<NAME>Tom</NAME>[code]....

Now, i keep getting this error message..

A string literal was expected, but no opening quote character was found. Error processing resource 'file:/C:/Users/S/Desk...

<CLASS ID=ā€¯Advanced Web Developmentā€¯>
----------^

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved