Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

string error

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello,

I'm currently using a marquee tag to scroll some text in my window. But I want to add some pictures in my marquee to illustrate the text but the whole html code has to be on a line and here I want to have some text below the picture and not beside it. So I want to make a table and then put in the cell my picture and my text but I have a problem!
I have an error: &quot;Unterminated string constant&quot; when I write finalslide = '<table><tr>' which is necessary to have my table. How can I solve this problem? Help please

Here is my Html code:

var leftrightslide=new Array()
var finalslide=''

leftrightslide[0]='<td><a href=&quot; height=&quot;82&quot; width=&quot;100&quot; src=&quot;../xml/tj1/10195.jpg&quot; border='1'/></a>blabla</td>'
leftrightslide[1]='<td><a href=&quot; height=&quot;82&quot; width=&quot;100&quot; src=&quot;../xml/tj1/10889.jpg&quot; border='1'/></a>blabla</td>'
leftrightslide[2]='<td><a href=&quot; height=&quot;82&quot; width=&quot;100&quot; src=&quot;../xml/tj1/11251.jpg&quot; border='1'/></a>blabla</td>'

finalslide = '<table><tr>'

for (var i=0 ; leftrightslide.length>i ; i++)
finalslide = finalslide+leftrightslide+&quot;&amp;#160;&amp;#160;&quot;

finalslide = finalslide + '</tr></table>'

document.write('<marquee id=&quot;ieslider&quot; class=&quot;scrollcell&quot; scrollAmount='0' style=&quot;width:'+sliderwidth+'&quot;>'+finalslide+'</marquee>')
 
try reposting your message, but uncheck the process TGML box right next to the submit button jared@aauser.com
 
-> alert (leftrightslide[0]) (and [1] and 2), i'm sure they are not correctly built - for instance : string='a and &quot;b&quot; and 'c' and d&quot; will understand string='a and &quot;b&quot; and'. The &quot;correct&quot; way to to declare a string is between &quot;&quot;, and to escape &quot; is \&quot;. For instance : string=&quot;a and \&quot;b \&quot; and 'c' and d&quot;
-> now alert(finalslide) i'm sure you'll get too many starting tag for the table and not enough closing ones !!!!! yours should look like : &quot;<table><tr> first line<table><tr>second line ....&quot; !!!
 
leftrightslide[num] are correctly built because when I make your changes with /&quot; and &quot;, the editor says that my line is not well formed and these are well shown.
And in my example finalslide has one table and tr tag in the beginning of his assignement and the same thing at the end so that seems to be ok. I only want to have one line of cells containing a picture+text. I still didn't know where the problem is!.... :(
 
what do you have *exactly* in leftrightslide[num] ? can you write it down here ? same for finaleside ? also, as jaredn already said, could you post again your code WITHOUT processing the tgml ? and beware that / is not \ :)
 
In leftrightslide{num}, I have a cell with an image and some descriptive text like in my HTML code below:

Here is my HTML code:

var leftrightslide=new Array()
var finalslide=''

leftrightslide[0]='<td><a href=&quot; height=&quot;82&quot; width=&quot;100&quot; src=&quot;../xml/tj1/10195.jpg&quot; border='1'/><br/>blabla</a></td>'
leftrightslide[1]='<td><a href=&quot; height=&quot;82&quot; width=&quot;100&quot; src=&quot;../xml/tj1/10889.jpg&quot; border='1'/></a>blabla</td>'
leftrightslide[2]='<td><a href=&quot; height=&quot;82&quot; width=&quot;100&quot; src=&quot;../xml/tj1/11251.jpg&quot; border='1'/></a>blabla</td>'

finalslide = '<table><tr>'

for (var i=0 ; leftrightslide.length>i ; i++)
finalslide = finalslide+leftrightslide+&quot;&amp;#160;&amp;#160;&quot;

finalslide = finalslide + '</tr></table>'
 
Maybe the single quotes around border='1' should be double quotes?
 
I've already tried to take them off but it doesn't change anything, I forgot to say that the error occurs when I make finalslide = '<table><tr>'
 
If I want to display some scrolling elements(picture+text), do I have to make two marquee one with my pictures and another with their description? How would you make it?
 
try escape the single quotes... it worked for me when I did that:

leftrightslide[0]='<td><a href=&quot; height=&quot;82&quot; width=&quot;100&quot; src=&quot;../xml/tj1/10195.jpg&quot; border=\'1\'/><br/>blabla</a></td>'
leftrightslide[1]='<td><a href=&quot; height=&quot;82&quot; width=&quot;100&quot; src=&quot;../xml/tj1/10889.jpg&quot; border=\'1\'/></a>blabla</td>'
leftrightslide[2]='<td><a href=&quot; height=&quot;82&quot; width=&quot;100&quot; src=&quot;../xml/tj1/11251.jpg&quot; border=\'1\'/></a>blabla</td>'
jared@aauser.com -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top