Link to home
Start Free TrialLog in
Avatar of theclassic
theclassicFlag for United States of America

asked on

Can you pass an array in Visual basic to javascript?

I have some code in visual basic, the main sub displays the parsed file contents, and createds an output that displays them as a list - can I alter this to pass it into a javscript array?


 Sub Main()
        Dim arr As New ArrayList
        arr = parseFile(Server.MapPath("Messageboard.html"))
        Dim a As Array = arr.ToArray  (HERE IS WHERE I THINK I CAN MAKE THIS PASS TO A JAVASCRIPT ARRAY>>>>)
        Dim sOutput As String = ""
        For i As Long = 0 To a.Length - 1
            sOutput = sOutput + a(i) + "<BR><BR><BR><BR><BR><BR>"  (HERE IS WHERE THE PARSED CONTENT IS ADDED)
            myLiteralControl.Text = sOutput (COULD JUST AS WELL BE RESPONSE WRITE ALSO< DISPLAYS THE HTML ON A PAGE)

        Next

    End Sub
Avatar of sh0e
sh0e

Sub printArray(intArray() As Integer)

Dim obj As Variant

For Each obj In intArray

Response.Write obj

Next

End Sub
Avatar of theclassic

ASKER

can you post with the namings used in my existing SUB, and then tell me how it would be passed to the javascript, say, this example (which as it is shown is using a data set and control to pass to the array - but i want to replace it with the example above)...?  Sorry I am somewhat of a begginner,,,
 

var currentMessageIndex = 0
var ns4 = (document.layers)? true:false;
var msie = (document.all)? true:false;
THIS VB SCRIPT WOULD BE REPLACED BY PASSING THE ARRAY YOU HAVE NAMED somehow....
var messages = new Array(<%= dsMessages.tables(0).rows().count %>);
<%
 dim intMessageCount as integer = 0
 dim drMessage as datarow
 for each drMessage in dsMessages.tables(0).rows
  response.write ("messages[" & intMessageCount & "] = """ & server.htmlDecode(server.htmlEncode(drMessage("Message"))) & """;" & vbcrlf)
  intMessageCount += 1
 next
%>
function startMessageBoard(){
 document.getElementById("innerDiv").innerHTML = messages[currentMessageIndex];
 window.setTimeout("moveMessagesUp()", 0);
}
What ASP is sending to the browser is text, not objects.  The VBScript ASP code executes on the server-side, and the JavaScript on the client side, so you cannot directly pass objects between them.  The objects must be serialized into text in between, this text being sent over HTTP.

server-side -> HTTP -> client side
ASP -> HTTP -> JavaScript

If you want to encapsulate the code, you can turn it into a function.

If you want to separate JavaScript from your server side code and data, you will have to separate the logic for pushing data, and the logic for JavaScript to grab data.  Something like a page that serializes data from the database into JSON (JavaScript Object Notation), which the JavaScript grabs using AJAX.  This will take a significant amount of learning and thinking, and would require a large amount of changes and time.

Example:
<%
Sub outputdatarow(dsMessages() as datarow)
dim intMessageCount as integer = 0
dim drMessage as datarow
for each drMessage in dsMessages.tables(0).rows
 response.write ("messages[" & intMessageCount & "] = """ & server.htmlDecode(server.htmlEncode(drMessage("Message"))) & """;" & vbcrlf)
 intMessageCount += 1
next
End Sub
%>
 
var currentMessageIndex = 0
var ns4 = (document.layers)? true:false;
var msie = (document.all)? true:false;
 
THIS VB SCRIPT WOULD BE REPLACED BY PASSING THE ARRAY YOU HAVE NAMED somehow....
var messages = new Array(<%= dsMessages.tables(0).rows().count %>);
<%
outputdatarow dsMessages
%>
function startMessageBoard(){
document.getElementById("innerDiv").innerHTML = messages[currentMessageIndex];
window.setTimeout("moveMessagesUp()", 0);
}

Open in new window

Avatar of NerdsOfTech
Have you tryed making your array dynamic so that you don't run into resize errors?
var currentMessageIndex = 0
var ns4 = (document.layers)? true:false;
var msie = (document.all)? true:false;
var messages = new Array(); // dynamic array
<%
dim intMessageCount as integer = 0
dim drMessage as datarow
for each drMessage in dsMessages.tables(0).rows
 response.write ("messages[" & intMessageCount & "] = """ & server.htmlDecode(server.htmlEncode(drMessage("Message"))) & """;" & vbcrlf)
 intMessageCount += 1
next
%>
function startMessageBoard(){
document.getElementById("innerDiv").innerHTML = messages[currentMessageIndex];
window.setTimeout("moveMessagesUp()", 0);
} 

Open in new window

var currentMessageIndex = 0;
var ns4 = (document.layers)? true:false;
var msie = (document.all)? true:false;
var messages = new Array(); // dynamic array
<%
dim intMessageCount as integer = 0
dim drMessage as datarow
for each drMessage in dsMessages.tables(0).rows
 response.write ("messages[" & intMessageCount & "] = """ & server.htmlDecode(server.htmlEncode(drMessage("Message"))) & """;" & vbcrlf)
 intMessageCount += 1
next
%>
function startMessageBoard(){
document.getElementById("innerDiv").innerHTML = messages[currentMessageIndex];
window.setTimeout("moveMessagesUp()", 0);
}

var currentMessageIndex = 0;
var ns4 = (document.layers)? true:false;
var msie = (document.all)? true:false;
var messages = new Array(); // dynamic array
<%
dim intMessageCount as integer = 0
dim drMessage as datarow
for each drMessage in dsMessages.tables(0).rows
 response.write (("messages[" & intMessageCount & "] = """ & server.htmlDecode(server.htmlEncode(drMessage("Message"))) & """;" & vbcrlf))
 intMessageCount += 1
next
%>
function startMessageBoard(){
document.getElementById("innerDiv").innerHTML = messages[currentMessageIndex];
window.setTimeout("moveMessagesUp()", 0);
} 

Open in new window

Hold up - I think I am confusing everyone......I posted this code awhile back and got to a point, but no one could figure it out - who is up for the challenge?
To explain the previous posts....The VB SCRIPT was from an older application that used a data base to retrieve messages.
I want to use the javascript from this older application that scrolls and fades each message with my new code. The new code was written to parse an html file that is generated from a internal application, and adds comments to each line of html, which is why the parser(new code) is written as it is - here is that code...
 
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Main()
End Sub
'
' *-----
' ** Constants
' *-----
Dim BEGIN_PATTERN As String = "<!--Begin MessageBoard:Content"
Dim END_PATTERN As String = "<!--End MessageBoard:Content"
'
' *-----
' ** function extractText - returns the text between the start and end tags
' *-----
Private Function extractText(ByVal txt As String, ByVal target1 _
As String, ByVal target2 As String) As String
Dim startPos As Long
Dim endPos As Long
Dim content As String = "" 
startPos = InStr(txt, target1)
endPos = InStr(txt, target2)
If startPos = 0 Or endPos = 0 Then
' start or end tag is missing. Set content = "".
content = "" 
Else
startPos += target1.Length() + 4
content = Mid$(txt, startPos, (endPos - startPos))
End If
Return content
End Function
 
'
' *-----
' ** function parseFile - returns an ArrayList of content strings extracted
' ** from the file passed in as an argument
' *-----
Function parseFile(ByVal fileName As String) As ArrayList
Dim arrList As New ArrayList
If System.IO.File.Exists(fileName) = True Then
Dim objReader As New System.IO.StreamReader(fileName)
Dim txLine As String = "" 
Do While objReader.Peek() <> -1
txLine = objReader.ReadLine()
If txLine.Contains(BEGIN_PATTERN) Then
Dim content As String = "" 
content = extractText(txLine, BEGIN_PATTERN, END_PATTERN)
arrList.Add(content)
End If
Loop
objReader.Close()
Else
Response.Write("This messageboard is currently under construction.")
End If
Return arrList
End Function
 
Sub Main()
Dim arr As New ArrayList
arr = parseFile(Server.MapPath("Messageboard.html"))
Dim a As Array = arr.ToArray
Dim sOutput As String = "" 
For i As Long = 0 To a.Length - 1
//This bottom section can simply be a repsonse.write instead of a control also.....

sOutput = sOutput + a(i) + "<BR><BR><BR><BR><BR><BR>"
myLiteralControl.Text = sOutput

Next
End Sub
End Class
//End of NEW CODE
 
Here is the older java and vb script from the older program (I want to pass the array listed here into a javascript array, i.e. replace the vb script pulling the array from a database, set up in a seperate vb file, but this would be all we were concerned with....

var currentMessageIndex = 0
var ns4 = (document.layers)? true:false;
var msie = (document.all)? true:false;
HERE IS WHERE I THINK I CAN PASS THE ARRAY SOMEHOW....
var messages = new Array(<%= dsMessages.tables(0).rows().count %>);
<%
 dim intMessageCount as integer = 0
 dim drMessage as datarow
 for each drMessage in dsMessages.tables(0).rows
  response.write ("messages[" & intMessageCount & "] = """ & server.htmlDecode(server.htmlEncode(drMessage("Message"))) & """;" & vbcrlf)
  intMessageCount += 1
 next
%>
function startMessageBoard(){
 document.getElementById("innerDiv").innerHTML = messages[currentMessageIndex];
 window.setTimeout("moveMessagesUp()", 0);
}
function moveMessagesUp(){
 if (ns4){
  document.layers["innerDiv"].visibility = "show";
 }
 
 if (msie){
  document.getElementById("innerDiv").style.visibility = 'visible';
 }
 
 if (document.getElementById("innerDiv").style.pixelTop != 10) {
  document.getElementById("innerDiv").style.pixelTop = document.getElementById("innerDiv").style.pixelTop - 1;
  window.setTimeout("moveMessagesUp()", 38);
 } else {
  hideCurrentMessageAndShowNext();  
 }
}
function hideCurrentMessageAndShowNext(){
 
 var timeToWait = 8000;
 
 window.setTimeout("hideMessages()", timeToWait/2);
 window.setTimeout("resetInnerDiv();", timeToWait);
 window.setTimeout("moveMessagesUp();", timeToWait);
}
function resetInnerDiv(){
 if (currentMessageIndex != messages.length - 1) {
  currentMessageIndex += 1;
 } else {
  currentMessageIndex = 0;
 }
 
 document.getElementById('innerDiv').innerHTML = messages[currentMessageIndex];
 document.getElementById('innerDiv').style.pixelTop = 50;
 
 if (ns4){
  document.layers["innerDiv"].visibility = "hide";
 }
 
 if (msie){
  document.getElementById('innerDiv').style.visibility='hidden';
 }
}
function hideMessages(){
 document.getElementById('innerDiv').style.width = '159px';
 document.getElementById('innerDiv').style.filter='blendTrans(duration=2)';
 document.getElementById('innerDiv').filters.blendTrans.apply();
 
 
 if (ns4){
  document.layers["innerDiv"].visibility = "hide";
 }
 
 if (msie){
  document.getElementById('innerDiv').style.visibility='hidden';
 }
 
 document.getElementById('innerDiv').filters.blendTrans.play();
}
 
Is everyone on the same page?
To be clear, I want to pass the array from the top visual basic code into the bottom section to get the same display effects of the old program....Thank you!!!
The modified "NEW" code.  I changed the function to output JavaScript array code.
(messages=['val1','val2','val3','val4',...];)
This program may fail if you have any single quotes in the text.  If so a(i) will need to be encoded.
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Main()
End Sub
'
' *-----
' ** Constants
' *-----
Dim BEGIN_PATTERN As String = "<!--Begin MessageBoard:Content"
Dim END_PATTERN As String = "<!--End MessageBoard:Content"
'
' *-----
' ** function extractText - returns the text between the start and end tags
' *-----
Private Function extractText(ByVal txt As String, ByVal target1 _
As String, ByVal target2 As String) As String
Dim startPos As Long
Dim endPos As Long
Dim content As String = ""
startPos = InStr(txt, target1)
endPos = InStr(txt, target2)
If startPos = 0 Or endPos = 0 Then
' start or end tag is missing. Set content = "".
content = ""
Else
startPos += target1.Length() + 4
content = Mid$(txt, startPos, (endPos - startPos))
End If
Return content
End Function
 
'
' *-----
' ** function parseFile - returns an ArrayList of content strings extracted
' ** from the file passed in as an argument
' *-----
Function parseFile(ByVal fileName As String) As ArrayList
Dim arrList As New ArrayList
If System.IO.File.Exists(fileName) = True Then
Dim objReader As New System.IO.StreamReader(fileName)
Dim txLine As String = ""
Do While objReader.Peek() <> -1
txLine = objReader.ReadLine()
If txLine.Contains(BEGIN_PATTERN) Then
Dim content As String = ""
content = extractText(txLine, BEGIN_PATTERN, END_PATTERN)
arrList.Add(content)
End If
Loop
objReader.Close()
Else
Response.Write("This messageboard is currently under construction.")
End If
Return arrList
End Function
 
 'replaced Sub Main with code to generate JavaScript array code
Sub Main
Dim arr As New ArrayList
arr = parseFile(Server.MapPath("Messageboard.html"))
Dim a As Array = arr.ToArray
Dim sOutput As String = ""
 
sOutput = "messages=["
 
For i As Long = 0 To a.Length - 1
sOutput = sOutput + a(i) + ","
Next 
 
sOutput = sOutput + "];"
myLiteralControl.Text = sOutput
End Sub
End Class

Open in new window

JavaScript code.  I placed the Literal control in the code to set the messages array.
var currentMessageIndex = 0
var ns4 = (document.layers)? true:false;
var msie = (document.all)? true:false;
 
<asp:literal runat="server" id="myLiteralControl" ></asp:literal>
 
function startMessageBoard(){
document.getElementById("innerDiv").innerHTML = messages[currentMessageIndex];
window.setTimeout("moveMessagesUp()", 0);
}
function moveMessagesUp(){
if (ns4){
 document.layers["innerDiv"].visibility = "show";
}
 
 if (msie){
 document.getElementById("innerDiv").style.visibility = 'visible';
}
 
 if (document.getElementById("innerDiv").style.pixelTop != 10) {
 document.getElementById("innerDiv").style.pixelTop = document.getElementById("innerDiv").style.pixelTop - 1;
 window.setTimeout("moveMessagesUp()", 38);
} else {
 hideCurrentMessageAndShowNext();  
}
}
function hideCurrentMessageAndShowNext(){
 
 var timeToWait = 8000;
 
 window.setTimeout("hideMessages()", timeToWait/2);
 window.setTimeout("resetInnerDiv();", timeToWait);
window.setTimeout("moveMessagesUp();", timeToWait);
}
function resetInnerDiv(){
if (currentMessageIndex != messages.length - 1) {
 currentMessageIndex += 1;
} else {
 currentMessageIndex = 0;
}
 
 document.getElementById('innerDiv').innerHTML = messages[currentMessageIndex];
document.getElementById('innerDiv').style.pixelTop = 50;
 
 if (ns4){
 document.layers["innerDiv"].visibility = "hide";
}
 
 if (msie){
 document.getElementById('innerDiv').style.visibility='hidden';
}
}
function hideMessages(){
 document.getElementById('innerDiv').style.width = '159px';
document.getElementById('innerDiv').style.filter='blendTrans(duration=2)';
document.getElementById('innerDiv').filters.blendTrans.apply();
 
 
if (ns4){
 document.layers["innerDiv"].visibility = "hide";
}
 
 if (msie){
 document.getElementById('innerDiv').style.visibility='hidden';
}
 
 document.getElementById('innerDiv').filters.blendTrans.play();
}

Open in new window

You will have to place the above code in the correct respective places in the .aspx and .aspx.vb files.

Below is my explanation of the issues and what I think you may not be understanding.  Also, why your question cannot be directly answered.
-----
Again, I think that you are misunderstanding that JavaScript is executed on the client-side, while the VBScript ASP code is executed on the server-side.  To the VBScript ASP engine, the JavaScript is nothing more than text to be sent to the client-side.
You cannot directly pass objects from the VBScript on the server-side to the JavaScript on the client-side.

The process from server to browser is as follows:
On the server, ASP VBScript executes some code and outputs text (that includes the JavaScript code).
Web Server sends this output text to the client's browser.
Client's browser parses text, sees JavaScript code and executes, and renders page.
I understand the client/serverside execution - that is the main problem with this - I have written the code for another scrolling board, that is a continuos scroll, and places the asp:literal in a div, and then javascript is applied to the contents of a div.  Because each piece of content needs to be affected seperately, you have to spluit each message up for what I am trying to do here, and then apply javascript to each message.
 
I ran your code - it is giving me a runtime error - Line 12, it says "[" expected....
Here is the aspx page...

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head>
<script language=javascript>
var currentMessageIndex = 0
var ns4 = (document.layers)? true:false;
var msie = (document.all)? true:false;

<asp:literal runat="server" id="myLiteralControl" ></asp:literal>

function startMessageBoard(){
document.getElementById("innerDiv").innerHTML = messages[currentMessageIndex];
window.setTimeout("moveMessagesUp()", 0);
}
function moveMessagesUp(){
if (ns4){
document.layers["innerDiv"].visibility = "show";
}

if (msie){
document.getElementById("innerDiv").style.visibility = 'visible';
}

if (document.getElementById("innerDiv").style.pixelTop != 10) {
document.getElementById("innerDiv").style.pixelTop = document.getElementById("innerDiv").style.pixelTop - 1;
window.setTimeout("moveMessagesUp()", 38);
} else {
hideCurrentMessageAndShowNext();
}
}
function hideCurrentMessageAndShowNext(){

var timeToWait = 8000;

window.setTimeout("hideMessages()", timeToWait/2);
window.setTimeout("resetInnerDiv();", timeToWait);
window.setTimeout("moveMessagesUp();", timeToWait);
}
function resetInnerDiv(){
if (currentMessageIndex != messages.length - 1) {
currentMessageIndex += 1;
} else {
currentMessageIndex = 0;
}

document.getElementById('innerDiv').innerHTML = messages[currentMessageIndex];
document.getElementById('innerDiv').style.pixelTop = 50;

if (ns4){
document.layers["innerDiv"].visibility = "hide";
}

if (msie){
document.getElementById('innerDiv').style.visibility='hidden';
}
}
function hideMessages(){
document.getElementById('innerDiv').style.width = '159px';
document.getElementById('innerDiv').style.filter='blendTrans(duration=2)';
document.getElementById('innerDiv').filters.blendTrans.apply();


if (ns4){
document.layers["innerDiv"].visibility = "hide";
}

if (msie){
document.getElementById('innerDiv').style.visibility='hidden';
}

document.getElementById('innerDiv').filters.blendTrans.play();
}
</script>
</head>
<body
<div id="outerDiv" name="outerDiv" style="position:relative; height:130px; width:159px; overflow:hidden;">
<div id="innerDiv" name="innerDiv" style="position:absolute; top:123px; left:0px; right:0px; visibility:visible;" class="body-nomarginprp">test</div>
</div>
</body>
</html>
 Here is the code behind...what am I missing?

Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Main()
End Sub
'
' *-----
' ** Constants
' *-----
Dim BEGIN_PATTERN As String = "<!--Begin MessageBoard:Content"
Dim END_PATTERN As String = "<!--End MessageBoard:Content"
'
' *-----
' ** function extractText - returns the text between the start and end tags
' *-----
Private Function extractText(ByVal txt As String, ByVal target1 _
As String, ByVal target2 As String) As String
Dim startPos As Long
Dim endPos As Long
Dim content As String = "" 
startPos = InStr(txt, target1)
endPos = InStr(txt, target2)
If startPos = 0 Or endPos = 0 Then
' start or end tag is missing. Set content = "".
content = "" 
Else
startPos += target1.Length() + 4
content = Mid$(txt, startPos, (endPos - startPos))
End If
Return content
End Function
'
' *-----
' ** function parseFile - returns an ArrayList of content strings extracted
' ** from the file passed in as an argument
' *-----
Function parseFile(ByVal fileName As String) As ArrayList
Dim arrList As New ArrayList
If System.IO.File.Exists(fileName) = True Then
Dim objReader As New System.IO.StreamReader(fileName)
Dim txLine As String = "" 
Do While objReader.Peek() <> -1
txLine = objReader.ReadLine()
If txLine.Contains(BEGIN_PATTERN) Then
Dim content As String = "" 
content = extractText(txLine, BEGIN_PATTERN, END_PATTERN)
arrList.Add(content)
End If
Loop
objReader.Close()
Else
Response.Write("This messageboard is currently under construction.")
End If
Return arrList
End Function
'replaced Sub Main with code to generate JavaScript array code
Sub Main()
Dim arr As New ArrayList
arr = parseFile(Server.MapPath("Messageboard.html"))
Dim a As Array = arr.ToArray
Dim sOutput As String = "" 
sOutput = "messages=["
For i As Long = 0 To a.Length - 1
sOutput = sOutput + a(i) + ","
Next
sOutput = sOutput + "];"
myLiteralControl.Text = sOutput
End Sub
End Class
 
Sorry, it seems I copy/pasted the unfinished version of the NEW code.  I took the liberty of adding single quote escaping code in.  If you still have problems please post the output.

Replace code behind with this:

Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Main()
End Sub
'
' *-----
' ** Constants
' *-----
Dim BEGIN_PATTERN As String = "<!--Begin MessageBoard:Content"
Dim END_PATTERN As String = "<!--End MessageBoard:Content"
'
' *-----
' ** function extractText - returns the text between the start and end tags
' *-----
Private Function extractText(ByVal txt As String, ByVal target1 _
As String, ByVal target2 As String) As String
Dim startPos As Long
Dim endPos As Long
Dim content As String = ""
startPos = InStr(txt, target1)
endPos = InStr(txt, target2)
If startPos = 0 Or endPos = 0 Then
' start or end tag is missing. Set content = "".
content = ""
Else
startPos += target1.Length() + 4
content = Mid$(txt, startPos, (endPos - startPos))
End If
Return content
End Function
 
'
' *-----
' ** function parseFile - returns an ArrayList of content strings extracted
' ** from the file passed in as an argument
' *-----
Function parseFile(ByVal fileName As String) As ArrayList
Dim arrList As New ArrayList
If System.IO.File.Exists(fileName) = True Then
Dim objReader As New System.IO.StreamReader(fileName)
Dim txLine As String = ""
Do While objReader.Peek() <> -1
txLine = objReader.ReadLine()
If txLine.Contains(BEGIN_PATTERN) Then
Dim content As String = ""
content = extractText(txLine, BEGIN_PATTERN, END_PATTERN)
arrList.Add(content)
End If
Loop
objReader.Close()
Else
Response.Write("This messageboard is currently under construction.")
End If
Return arrList
End Function
 
 'replaced Sub Main with code to generate JavaScript array code
Sub Main
Dim arr As New ArrayList
arr = parseFile(Server.MapPath("Messageboard.html"))
Dim a As Array = arr.ToArray
Dim sOutput As String = ""
 
sOutput = "messages=["
 
For i As Long = 0 To a.Length - 1
sOutput = sOutput + "'" + REPLACE(a(i),"'","\'") + "',"
Next 
 
sOutput = sOutput + "];"
myLiteralControl.Text = sOutput
End Sub
End Class

Open in new window

I replaced the code behind with your file - when I go to run/debug the page, it opens, but you only see two small dots that appear to be the messages starting to scroll, but nothing happens, just still - any ideas - can use the div as an object and then place the literal inside of that?  I am sorry, I don't know the syntax very well - thanks for your help
I got it, I forgot to place the start messageboard tag in the body tag - but here are the issues, if you can address them.  If I dont hear back, i will award points and repost, but you are the only person who has figured this out, so it would be appreciated -
The messages are appearing out of know where halfway up the div, and then scrolling up, bnot scrolling up from the bottom
 
There is a fourth message that scrolls - the text reads "undefined" - did you set the number of messages anywhere in the code - how can this be altered to get rid of the undefined text
Hello?
Sorry, I have been busy of late, and it's hard to keep track of all the floating threads.
To settle the "undefined", replace the client-side line:
if (currentMessageIndex != messages.length - 1) {
with
if (currentMessageIndex != messages.length - 2) {


As for the "appearing out of nowhere", are you sure the original script works the way you want?
I did not modify any logic other than the messages array.
It sounds to me like a problem with the JavaScript text scroller.
Is that line something i will have to modify based on the number of messages parsed?Thanks for your help!
ASKER CERTIFIED SOLUTION
Avatar of sh0e
sh0e

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I will post if there are any other questions THANKS!!!