Kamal_Hi_tek
09-19-2003, 10:27 PM
I'm having problem with this code. I have Iframe and suppose to show the frame1 with this code names in a table where you could click and information showing on the other frame2.
Please let me know any suggestions.
thanx
Here's the code...Note: This is just the frame1 code, which doesn't show nothing at all.
<HTML>
<HEAD>
<TITLE>Frameset Address List</TITLE>
<style><!--
BODY, TD {font-family:Verdana, Arial, sans-serif; font-size:9pt;}
-->
</style>
<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">
<!--
//--------------------------------------------------------------------------
/**
* function displayDetail(index)
* Display a Detailed Line
*
* @param integer index the index into the people array
*/
function displayDetail(index) {
retVal=
"<table bgcolor='#7596B8' border='0' cellpadding='0' cellspacing='0'>"
+ "<tr><td>" +
"<table border='0' cellpadding='10' cellspacing='1'>"
+ "<tr><td bgcolor='#F7F9F9'>";
retVal += myList[index]['lastName'];
retVal += "\n<br>Put in last name and <br>practice adding fake stuff"
+ <br>(e.g. address, etc.) here";
retVal += "</td>\n</tr>\n</table>"; // get rid for class
retVal += "</td>\n</tr>\n</table>"; // get rid for class close outer table
writeContent(retVal);
}
//--------------------------------------------------------------------------
/**
* function writeContent(pageContent)
* Writes the HTML string to the second frame
*
* @param string pageContent the HTML we want to send to the detail frame
* @return nothing
*/
function writeContent(pageContent) {
content = "<HTML>\n<HEAD>";
content += "\n<style><!--";
content += "\nBODY, TD {font-family:Verdana,Arial,sans-serif;" +
" font-size:9pt;}";
content += "\n--\>";
content += "\n</style>";
content += "\n<\/HEAD><BODY bgcolor='white'>";
content += "\n<H1>Detailed Information<\/H1>" + pageContent;
content += "\n<\/BODY><\/HTML>";
//alert ("content=\n" + content);
parent.content.document.write(content);
parent.content.document.close();
}
myList=new Array();
myList[0]={firstName:"John", lastName:"Jones"};
myList[1]={firstName:"Pat", lastName: "Johnson"};
myList[2]={firstName:"Chris", lastName: "Smith"};
myList[3]={firstName:"Jody", lastName: "Adams"};
myList[4]={firstName:"Bob", lastName: "Owens"};
// End hiding script from old browsers -->
</SCRIPT>
</HEAD>
<BODY BGCOLOR="WHITE" >
<H1 ALIGN="CENTER">My Addresses</H1>
<P ALIGN="CENTER">
<table><tr><td valign="top">
<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">
<!--
// now start creating the list in the left nav
document.write ("<br><b>Address List</b>");
for (myList) {
document.write ("\n<br><a href='javascript:displayDetail(" + entry + ")'>"
+ myList[entry]['lastName'] + "</a> " +myList[entry]['firstName'] );
}
//-->
</SCRIPT>
</td></tr></table>
</BODY>
</HTML>
Please let me know any suggestions.
thanx
Here's the code...Note: This is just the frame1 code, which doesn't show nothing at all.
<HTML>
<HEAD>
<TITLE>Frameset Address List</TITLE>
<style><!--
BODY, TD {font-family:Verdana, Arial, sans-serif; font-size:9pt;}
-->
</style>
<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">
<!--
//--------------------------------------------------------------------------
/**
* function displayDetail(index)
* Display a Detailed Line
*
* @param integer index the index into the people array
*/
function displayDetail(index) {
retVal=
"<table bgcolor='#7596B8' border='0' cellpadding='0' cellspacing='0'>"
+ "<tr><td>" +
"<table border='0' cellpadding='10' cellspacing='1'>"
+ "<tr><td bgcolor='#F7F9F9'>";
retVal += myList[index]['lastName'];
retVal += "\n<br>Put in last name and <br>practice adding fake stuff"
+ <br>(e.g. address, etc.) here";
retVal += "</td>\n</tr>\n</table>"; // get rid for class
retVal += "</td>\n</tr>\n</table>"; // get rid for class close outer table
writeContent(retVal);
}
//--------------------------------------------------------------------------
/**
* function writeContent(pageContent)
* Writes the HTML string to the second frame
*
* @param string pageContent the HTML we want to send to the detail frame
* @return nothing
*/
function writeContent(pageContent) {
content = "<HTML>\n<HEAD>";
content += "\n<style><!--";
content += "\nBODY, TD {font-family:Verdana,Arial,sans-serif;" +
" font-size:9pt;}";
content += "\n--\>";
content += "\n</style>";
content += "\n<\/HEAD><BODY bgcolor='white'>";
content += "\n<H1>Detailed Information<\/H1>" + pageContent;
content += "\n<\/BODY><\/HTML>";
//alert ("content=\n" + content);
parent.content.document.write(content);
parent.content.document.close();
}
myList=new Array();
myList[0]={firstName:"John", lastName:"Jones"};
myList[1]={firstName:"Pat", lastName: "Johnson"};
myList[2]={firstName:"Chris", lastName: "Smith"};
myList[3]={firstName:"Jody", lastName: "Adams"};
myList[4]={firstName:"Bob", lastName: "Owens"};
// End hiding script from old browsers -->
</SCRIPT>
</HEAD>
<BODY BGCOLOR="WHITE" >
<H1 ALIGN="CENTER">My Addresses</H1>
<P ALIGN="CENTER">
<table><tr><td valign="top">
<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">
<!--
// now start creating the list in the left nav
document.write ("<br><b>Address List</b>");
for (myList) {
document.write ("\n<br><a href='javascript:displayDetail(" + entry + ")'>"
+ myList[entry]['lastName'] + "</a> " +myList[entry]['firstName'] );
}
//-->
</SCRIPT>
</td></tr></table>
</BODY>
</HTML>