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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript window and array value

Status
Not open for further replies.

jordan11

Technical User
May 24, 2003
150
0
0
GB
Hi,
I would like to open a new window with the results of an array.
can anyone tell me how to can be. This is what I have so far

<script language="JavaScript">
<!--
function viewdetails() {
var theURL = '< & arrLog(0,i) & >';
window.open(theURL,'checkLog','width=780,height=300,scrollbars=yes,resizable=yes');
}
//-->
</script>


But I get the error bad url.

Can anyone help.

Thanks in advance
 
That usually happens when you try to open the URL "< & arrLog(0,i) & >"

What does your array contain?

Cheers,
Dian
 
I want to display the contents of a email message so when the user clicks details a window opens and the email messsage is shown. At the moment I have a title so when you put the mouse over some of the message is displayed but I want the contents to show in a open window instead.

Thanks
 
I have posted some more info so you have some light on what I am trying to do.
I have an array of the results from my database table and at the moment I want to display the contents of a email message so when the user clicks details a window opens and the email messsage is shown.

Code:
For i = 0 to numLog
	Response.Write("<tr valign=""top""><td nowrap>" & tidyDate(arrLog(1,i)) & "</td><td nowrap>" & arrLog(2,i) & "</td><td nowrap><b><a href=""mailto:" & arrLog(3,i) & """>" & arrLog(3,i) & "</a></b></td><td nowrap align=""center"">" & arrLog(4,i) & "</td><td>" & arrLog(5,i) & " - <a href=""#"" title=""" & arrLog(6,i) & """ onClick=""viewdetails('" & arrLog(0,i) & "');"">details</a></td><td nowrap><input name=""counterID"" type=""hidden"" value=""" & arrLog(0,i) & """></td></tr>" & vbCrLf)
Next
this will give the first item.
no idea what is "i" doing in your code, post more code if you want more help.[/QUOTE]


Code:
function viewdetails() {
	var theURL = arrLog[0];
	window.open(theURL,'checkLog','width=780,height=300,scrollbars=yes,resizable=yes');
}

I changed the array to var theURL = arrLog[0]; but the window does not open I just get a error on page message. Could this have anything to do with the fact that the window with array results I am trying to open is already in a window?

Thanks
 
I repeat the question: what does arrLog[0] contain?

Cheers,
Dian
 
arrLog[0] should be arrLog[6] which contains the email message from the database.

Thanks
 
From your code, it appears to contain just the subject od the email.

Cheers,
Dian
 
basically what is happening is someone clicks on a link that opens a window with contains the date, name , email, and email message, I then want them to be able to click on details and open another window that shows the contains of the info in the details, at the moment if I put the mouse over I can see the the email message as I have a title based on the code below which is the body.
Code:
<td>" & arrLog(5,i) & " - <a href=""#"" title=""" & arrLog(6,i) & """ onClick=""viewdetails('" & arrLog(6,i) & "');"">details</a></td>

I added
Code:
onClick=""viewdetails
to call
Code:
<script language="JavaScript">
<!--
function viewdetails() {
	var theURL = arrLog[0];
	window.open(theURL,'checkLog','width=780,height=300,scrollbars=yes,resizable=yes');
}
//-->
</script>

which is the head of my code.

I do not have to use this method I could only think of using javascript to open a new window.

Thanks
 
Thanks for your help but I have managed to work it out.
 
A nice practice is to share your success so other can use it.

Cheers,
Dian
 
I created file called "text.asp" with the code below:
Code:
<%
Response.Write(Request("text"))
%>

changed the javascript as shown below and everything worked fine.
Code:
<script language="JavaScript" type="text/javascript">
function viewdetails(strText) {
	window.open("text.asp?text="+strText, "checkLog", "width=780,height=30  0,scrollbars=yes,resizable=yes");
}
</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top