Link to home
Start Free TrialLog in
Avatar of ryebooks
ryebooks

asked on

HOW DO U WRITE TEXT IN IFRAME ON SEPERATE LINES?

yeah hi i have this problem, ok i figured out how to write from parent into iframe but the thing is everytime a new text is written in iframe the old one gets over written, So is there any way to skip a line and make the new text made written on a new line

-------------------
Iframe code
-------------------
<IFRAME name=contact width="130" height="410">
  [Your user agent does not support frames or is currently configured
  not to display frames. However, you may visit
  <A href="searchpop.asp">to search.</A>]</IFRAME>

--------------
Code from Parent window: Writes text in IFRAME
-------------
<SCRIPT>
function results (form) {
    var p = form.name.value;
    address = form.address.value;
    address = address.split("*");
    address = address.join("");
    i = frames["contact"];
    i.document.open();
  i.document.writeln('<table width="225" align="center"><tr align="center" bgcolor="#ECE7E7"><td>');
 i.document.writeln('<font size="2" color="#903860">');
 i.document.writeln(p + ' At <a href="mailto:');
 i.document.writeln(address);
 i.document.writeln('">');
 i.document.writeln(address);
 i.document.writeln('</font></td></tr></table></div>');
}
</SCRIPT>
Avatar of James Rodgers
James Rodgers
Flag of Canada image

add <br> wherer you want the line breaks to appear or in the text add \n inside the javascript variables this will cause a new line
can you post more of the code, the form, so i can properly test
what do you want the outptut to loo like?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
      <title>Untitled</title>
      <SCRIPT>
function results (form) {
    var p = form.name.value;
    address = form.address.value;
    address = address.split("*");
    address = address.join("");
    i = frames["contact"];
    i.document.open();
  i.document.writeln('<table width="225" align="center"><tr align="center" bgcolor="#ECE7E7"><td>');
 i.document.writeln('<font size="2" color="#903860">');
 i.document.writeln(p + ' At<br><a href="mailto:');
 i.document.writeln(address);
 i.document.writeln('">');
 i.document.writeln(address);
 i.document.writeln('</font></td></tr></table></div>');
}
</SCRIPT>
</head>

<body onLoad="results(just)">
<form name="just">
<input type="text" name="name" value="some person">
<input type="text" name="address" value="some address">
<IFRAME name=contact width="130" height="410">
  [Your user agent does not support frames or is currently configured
  not to display frames. However, you may visit
  <A href="searchpop.asp">to search.</A>]</IFRAME>

</form>

</body>
</html>
or this

formats the source of the iframe

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
      <title>Untitled</title>
      <SCRIPT>
function results (form) {
    var p = form.name.value;
    address = form.address.value;
    address = address.split("*");
    address = address.join("");
    i = frames["contact"];
    i.document.open();
  i.document.writeln('<table width="225" align="center">\n\t<tr align="center" bgcolor="#ECE7E7">\n\t\t<td>');
 i.document.writeln('\n<font size="2" color="#903860">');
 i.document.writeln(p + ' At<br><a href="mailto:' + address + '">');
 i.document.writeln(address);
 i.document.writeln('</font>\n\t\t</td>\n\t</tr>\n</table>\n</div>');
}
</SCRIPT>
</head>

<body onLoad="results(just)">
<form name="just">
<input type="text" name="name" value="some person">
<input type="text" name="address" value="some address">
<IFRAME name=contact width="130" height="410">
  [Your user agent does not support frames or is currently configured
  not to display frames. However, you may visit
  <A href="searchpop.asp">to search.</A>]</IFRAME>

</form>

</body>
</html>
ok... i misunderstood the question

instead of

 i.document.writeln('<table width="225" align="center"><tr align="center" bgcolor="#ECE7E7"><td>');
 i.document.writeln('<font size="2" color="#903860">');
 i.document.writeln(p + ' At<br><a href="mailto:');
 i.document.writeln(address);
 i.document.writeln('">');
 i.document.writeln(address);
 i.document.writeln('</font></td></tr></table></div>');

have a global variable

strContent="";

and set it in the  outptut
strrContent=strContent+ '<tr align="center" bgcolor="#ECE7E7"><td><font size="2" color="#903860">' + p + ' At<br><a href="mailto:'
i.document.writeln('<table width="225" align="center">);

hit enter by mistake.....

ok... i misunderstood the question

instead of

 i.document.writeln('<table width="225" align="center"><tr align="center" bgcolor="#ECE7E7"><td>');
 i.document.writeln('<font size="2" color="#903860">');
 i.document.writeln(p + ' At<br><a href="mailto:');
 i.document.writeln(address);
 i.document.writeln('">');
 i.document.writeln(address);
 i.document.writeln('</font></td></tr></table></div>');

have a global variable

strContent="";

and set it in the  outptut
strContent=strContent+ '<tr align="center" bgcolor="#ECE7E7"><td><font size="2" color="#903860">' + p + ' At <a href="mailto:' + address + '">' + address + '</font></td></tr>';
i.document.writeln('<table width="225" align="center">);
i.document.writeln(strContent);
i.document.writeln('</table>');

now for each line you want to write just add it to the strContent variable
 
Avatar of ryebooks
ryebooks

ASKER

Wow, in less then 1 hours so many comments...lol..ok let me give the last sol a shot
could u be more clear
i mean do i past
the
============
strContent="";
and set it in the  outptut
strContent=strContent+ '<tr align="center" bgcolor="#ECE7E7"><td><font size="2" color="#903860">' + p + ' At <a href="mailto:' + address + '">' + address + '</font></td></tr>';
i.document.writeln('<table width="225" align="center">);
i.document.writeln(strContent);
i.document.writeln('</table>');
============
in a sepearate script? like this (is it supposed to be on the parent page)
<script>
strContent="";
and set it in the  outptut
strContent=strContent+ '<tr align="center" bgcolor="#ECE7E7"><td><font size="2" color="#903860">' + p + ' At <a href="mailto:' + address + '">' + address + '</font></td></tr>';
i.document.writeln('<table width="225" align="center">);
i.document.writeln(strContent);
i.document.writeln('</table>');
</script>
try this it might give you a better idea of what i am talking about

also try not to use key/reserved word as values ie name, try to preface object names with the type eg txtName, text box or radTest, radio button

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
      <title>Untitled</title>
      <SCRIPT>
      strContent="";
      
      function setContent(address,name){  
    address = address.split("*");
    address = address.join("");
      strContent=strContent+ '<tr align="center" bgcolor="#ECE7E7"><td><font size="2" color="#903860">' + name + ' At <a href="mailto:' + address + '">' + address + '</font></td></tr>';
      results(document.forms[0]);
      }
      
function results (form) {
 
    i = frames["contact"];
    i.document.open();

i.document.writeln('<table width="225" align="center">');
i.document.writeln(strContent);
i.document.writeln('</table>');
}
</SCRIPT>
</head>

<body onLoad="results(just)">
<form name="just">
<input type="text" name="tname" value="some person">
<input type="text" name="address" value="some address">
<IFRAME name=contact width="130" height="410">
  [Your user agent does not support frames or is currently configured
  not to display frames. However, you may visit
  <A href="searchpop.asp">to search.</A>]</IFRAME>
<input type="button" onclick="setContent(this.form.address.value,this.form.tname.value)" value="go">
</form>

</body>
</html>
Also i am using a ASP so not sure if global variable is something that my server might have, i tried the above script on the PWS but got errrors "object no defined"
no the global in this case is is js so will not interfere with you asp...

did you rename the  the text box?

ie
this is what i am using....
<input type="text" name="tname" value="some person">



 
ok....
try this


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
      <title>Untitled</title>
      <SCRIPT>
      strContent="";
      
      function setContent(address,name){  
    address = address.split("*");
    address = address.join("");
      strContent=strContent+ '<tr align="center" bgcolor="#ECE7E7"><td><font size="2" color="#903860">' + name + ' At <a href="mailto:' + address + '">' + address + '</font></td></tr>';
      results(document.forms[0]);
      }
      
function results (form) {
 
    i = frames["contact"];
    i.document.open();

i.document.writeln('<table width="225" align="center">');
i.document.writeln(strContent);
i.document.writeln('</table>');
}
</SCRIPT>
</head>

<body onLoad="results(just)">
<form name="just">
<input type="text" name="name" value="some person">
<input type="text" name="address" value="some address">
<IFRAME name=contact width="130" height="410">
  [Your user agent does not support frames or is currently configured
  not to display frames. However, you may visit
  <A href="searchpop.asp">to search.</A>]</IFRAME>
<input type="button" onclick="setContent(this.form.address.value,document.forms[0].elements['name'].value)" value="go">
</form>

</body>
</html>
OK that did work, however when i tried implementing it into my asp script it did work.....don't know why

==========
My ASP script
==========
<html>
<head>
<title>RYEBOOKS.COM SEARCH</title>
 <SCRIPT>
     strContent="";
     
     function setContent(address,name){  
    address = address.split("*");
    address = address.join("");
     strContent=strContent+ '<tr align="center" bgcolor="#ECE7E7"><td><font size="2" color="#903860">' + name + ' At <a href="mailto:' + address + '">' + address + '</font></td></tr>';
     results(document.forms[0]);
     }
     
function results (myform) {
 
    i = frames["contact"];
    i.document.open();

i.document.writeln('<table width="225" align="center">');
i.document.writeln(strContent);
i.document.writeln('</table>');
}
</SCRIPT>


<style type="text/css">
<!--
body
{
scrollbar-base-color: #000000;
scrollbar-arrow-color: #FFFFFF;
scrollbar-darkshadow-color: #000000;
scrollbar-face-color: #903860;
scrollbar-highlight-color: #FFFFFF;
scrollbar-shadow-color: #FFFFFF;
scrollbar-3dlight-color: #000000;
}
-->
</style>
</head>

<body onLoad="results(myform);">
<table>
<tr>
<td valign="top">
<IFRAME name=main width="135" height="425">
  [Your user agent does not support frames or is currently configured
  not to display frames. However, you may visit
  <A href="nonframe.html">to search.</A>]</IFRAME>
</td>
<td valign="top">
<%
' Constants ripped from adovbs.inc:
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adCmdText = &H0001

' Our own constants:
Const PAGE_SIZE = 10  ' The size of our pages.

' Declare our variables... always good practice!
Dim strURL     ' The URL of this page so the form will work
               ' no matter what this file is named.

Dim cnnSearch  ' ADO connection
Dim rstSearch  ' ADO recordset

Dim cnnSearch1  ' ADO connection
Dim rstSearch1 ' ADO recordset
Dim strDBPath  ' path to our Access database (*.mdb) file

Dim strSQL     ' The SQL Query we build on the fly
Dim strSearch  ' The text being looked for
Dim strSearch2
Dim iRecordCount1
Dim iPageCurrent ' The page we're currently on
Dim iPageCount   ' Number of pages of records
Dim iRecordCount ' Count of the records returned
Dim I            ' Standard looping variable
strSearch2=0


' Retreive the URL of this page from Server Variables
strURL = Request.ServerVariables("URL")

' Retreive the term being searched for.  I'm doing it on
' the QS since that allows people to bookmark results.
' You could just as easily have used the form collection.


strSearch = Request.QueryString("search")


strSearch = Replace(strSearch, "'", "''")
' Retrieve page to show or default to the first
If Request.QueryString("page") = "" Then
      iPageCurrent = 1
Else
      iPageCurrent = CInt(Request.QueryString("page"))
End If

' Since I'm doing this all in one page I need to see if anyone
' has searched for something.  If they have we hit the DB.
' O/W I just show the search form and quit.
%>


           <table align="center"><tr align="center">

<td>
 <p align="center"><form action="<%= strURL %>" method="get"><input name="search" value="<%= strSearch %>" size="45" style="color:rgb(144,60,96); background-color:rgb(232,228,224);" /><input type="submit" name="submit" value="BOOK SEARCH" style="font-size:11; color:white; background-color:rgb(144,60,96);">
   </font></form> </td>
</tr></table>
<%
If strSearch <> "" Then
      ' MapPath of virtual database file path to a physical path.
      ' If you want you could hard code a physical path here.
      


      ' Create an ADO Connection to connect to the sample database.
      ' We're using OLE DB but you could just as easily use ODBC or a DSN.
      Set cnnSearch = Server.CreateObject("ADODB.Connection")
Set cnnSearch1 = Server.CreateObject("ADODB.Connection")
      ' This line is for the Access sample database:
      cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\data\log3.mdb;"
cnnSearch1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\data\log3.mdb;"

strSQL1 = "SELECT c2 " _
            & "FROM tbl1 " _
            & "WHERE c2 LIKE '%" & Replace(strSearch2, "'", "''") & "%' "

      ' We're actually using SQL Server so we use this line instead:

Set rstSearch1 = Server.CreateObject("ADODB.Recordset")
rstSearch1.Open strSQL1, cnnSearch1, adOpenStatic, adLockReadOnly, adCmdText



      ' Build our query based on the input.
            strSQL = "SELECT t1, t2, t3, t4, c1, c2, sr, dd1, id, dd2 " _
            & "FROM tbl1 " _

            & "WHERE t1 LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
            & "OR t2 LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
                & "OR dd1 LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
                             & "ORDER BY c2 DESC;"

      ' Execute our query using the connection object.  It automatically
      ' creates and returns a recordset which we store in our variable.
      Set rstSearch = Server.CreateObject("ADODB.Recordset")
      rstSearch.PageSize  = PAGE_SIZE
      rstSearch.CacheSize = PAGE_SIZE

      ' Open our recordset
      rstSearch.Open strSQL, cnnSearch, adOpenStatic, adLockReadOnly, adCmdText

      ' Get a count of the number of records and pages
      ' for use in building the header and footer text.
      iRecordCount = rstSearch.RecordCount
      iPageCount   = rstSearch.PageCount

      If iRecordCount = 0 Then
            ' Display no records error.
            %>

      <p align="center"><FONT color='#903860'>
            No records found.  Please try again.
            </p>
            <%
      Else
            ' Move to the page we need to show.      
            rstSearch.AbsolutePage = iPageCurrent

            ' Show a quick status line letting people know where they are:
            %>

                         <table align=right width=100%  border=0 cellpadding=0 cellspacing=0 bgcolor="#903860">
<tr>
   <td align="left"> <font face="verdana" size="1" color="#FFFFFF">&nbsp;  THERE ARE CURRENTLY <%=rstSearch1.RecordCount%> BOOKS IN THE RYEBOOKS DATABASE</font></td>
<td align="right"><font face="verdana" size="1" color="#FFFFFF"><%=date%> &nbsp; </font></td>

</tr>
</table>


            <p align="center"><FONT color='#903860'>
            <%= iRecordCount %> Records Found.
            Displaying page <%= iPageCurrent %>
            of <%= iPageCount %>:
            </p>
            <%
            ' Display a table of the data in the recordset.  We loop through the
            ' recordset displaying the fields from the table and using MoveNext
            ' to increment to the next record.  We stop when we reach EOF.
            ' For fun I'm combining some fields and showwing you can do more then
            ' just spit out the data in the form it is in in the table.
            %>




            <table border="1" align="center" bgcolor='#903860'>
            <tr>

            <th><font color="white">BOOK TITLE</th>
            <th><font color="white">BOOK AUTHOR</th>
            <th><font color="white">PRICE($CDN)</th>
            <th><font color="white">COURSE CODE</th>
                              </tr>

            <%
            Do While Not rstSearch.EOF And rstSearch.AbsolutePage = iPageCurrent
                  %>
                  <tr BGCOLOR='#ECE7E7'>
                  <td align=center> <font size="2"/>
 <%= rstSearch.Fields("t1").Value %></td><td align=center><font size="2"/><%= rstSearch.Fields("t2").Value %></td>
                  <td align=center><font size="2"/> <font color="#903860"><b><%= rstSearch.Fields("t3").Value %></b></td><td align=center><font size="2"/><%= rstSearch.Fields("dd1").Value %></td></tr>
                  <tr BGCOLOR="white"><td><font size="2"/> <i><%= rstSearch.Fields("dd2").Value %></i></td>


<td align=center><font size="2"/> <form name="myform"> <input name ="name" value = "<%= rstSearch.Fields("c1").Value %>" type="hidden" /> <input name="address" value="*<%= rstSearch.Fields("t4").Value %>" type="hidden"> <input type="button" value="CONTACT" onclick="setContent(this.form.address.value,document.forms[0].elements['name'].value)" style="font-size:11; color:white; background-color:rgb(144,60,96);">
 
 </form></td>


<td align=center><font size="2"/> Posted On <%= rstSearch.Fields("c2").Value %></td><td align=center><font size="2"/> Book Is For <font color="#903c60"><b><%= rstSearch.Fields("sr").Value %></b></font></td></tr>

<tr><td>   </td></tr><tr><td>    </td></tr><tr><td>    </td></tr><tr><td>    </td></tr>
<%

                  rstSearch.MoveNext
            Loop
            %>
            </table>

            <p>
            <%
            ' Now we need to show our navigation links:
            
            ' Show "previous" and "next" page links which pass the page to
            ' view our search parameter.  You could also use form buttons
            ' but I find this looks better.
            If iPageCurrent > 1 Then
                  %>

                  <a href="<%= strURL %>?search=<%= Server.URLEncode(strSearch) %>&page=<%= iPageCurrent - 1 %>">[&lt;&lt; Prev]</a>
                  
<%
            End If

            ' You can also show page numbers:
            For I = 1 To iPageCount
                  If I = iPageCurrent Then
                        %>
                        <%= I %>
                        <%
                  Else
                        %>
                        <a href="<%= strURL %>?search=<%= Server.URLEncode(strSearch) %>&page=<%= I %>"><%= I %></a>
                        <%
                  End If
            Next 'I

            If iPageCurrent < iPageCount Then
                  %>
                  <a href="<%= strURL %>?search=<%= Server.URLEncode(strSearch) %>&page=<%= iPageCurrent + 1 %>">[Next &gt;&gt;]</a>
                  <%
            End If
            %>
            </p>
            <%
      End If

      ' Close our recordset and connection and dispose of the objects
      rstSearch.Close
      Set rstSearch = Nothing
      cnnSearch.Close
      Set cnnSearch = Nothing
rstSearch1.Close
      Set rstSearch1 = Nothing
      cnnSearch1.Close
      Set cnnSearch1 = Nothing
End If
%>

</body>

</td>
</html>
can you post the compiled output, source from the browser
html>
<head>
<title>RYEBOOKS.COM SEARCH</title>
 <SCRIPT>
     strContent="";
     
     function setContent(address,name){  
    address = address.split("*");
    address = address.join("");
     strContent=strContent+ '<tr align="center" bgcolor="#ECE7E7"><td><font size="2" color="#903860">' + name + ' At <a href="mailto:' + address + '">' + address + '</font></td></tr>';
     results(document.forms[0]);
     }
     
function results (myform) {
 
    i = frames["contact"];
    i.document.open();

i.document.writeln('<table width="225" align="center">');
i.document.writeln(strContent);
i.document.writeln('</table>');
}
</SCRIPT>


<style type="text/css">
<!--
body
{
scrollbar-base-color: #000000;
scrollbar-arrow-color: #FFFFFF;
scrollbar-darkshadow-color: #000000;
scrollbar-face-color: #903860;
scrollbar-highlight-color: #FFFFFF;
scrollbar-shadow-color: #FFFFFF;
scrollbar-3dlight-color: #000000;
}
-->
</style>
</head>

<body onLoad="results(myform);">
<table>
<tr>
<td valign="top">
<IFRAME name=main width="135" height="425">
  [Your user agent does not support frames or is currently configured
  not to display frames. However, you may visit
  <A href="nonframe.html">to search.</A>]</IFRAME>
</td>
<td valign="top">



           <table align="center"><tr align="center">

<td>
 <p align="center"><form action="/search.asp" method="get"><input name="search" value="physics" size="45" style="color:rgb(144,60,96); background-color:rgb(232,228,224);" /><input type="submit" name="submit" value="BOOK SEARCH" style="font-size:11; color:white; background-color:rgb(144,60,96);">
   </font></form> </td>
</tr></table>


                         <table align=right width=100%  border=0 cellpadding=0 cellspacing=0 bgcolor="#903860">
<tr>
   <td align="left"> <font face="verdana" size="1" color="#FFFFFF">&nbsp;  THERE ARE CURRENTLY 835 BOOKS IN THE RYEBOOKS DATABASE</font></td>
<td align="right"><font face="verdana" size="1" color="#FFFFFF">12/8/03 &nbsp; </font></td>

</tr>
</table>


            <p align="center"><FONT color='#903860'>
            16 Records Found.
            Displaying page 1
            of 2:
            </p>
            




            <table border="1" align="center" bgcolor='#903860'>
            <tr>

            <th><font color="white">BOOK TITLE</th>
            <th><font color="white">BOOK AUTHOR</th>
            <th><font color="white">PRICE($CDN)</th>
            <th><font color="white">COURSE CODE</th>
                              </tr>

            
                  <tr BGCOLOR='#ECE7E7'>
                  <td align=center> <font size="2"/>
 THE PHYSICS OF SOLID STATE ELECTRONIC DEVICES: LECTURE NOTES... </td><td align=center><font size="2"/>Fred C. Bateman</td>
                  <td align=center><font size="2"/> <font color="#903860"><b>$5</b></td><td align=center><font size="2"/>PCS224</td></tr>
                  <tr BGCOLOR="white"><td><font size="2"/> <i>Lecture notes for PCS 224</i></td>


<td align=center><font size="2"/> <form name="myform"> <input name ="name" value = "dharris" type="hidden" /> <input name="address" value="*mad_hookups2001@yahoo.com" type="hidden"> <input type="button" value="CONTACT" onclick="setContent(this.form.address.value,document.forms[0].elements['name'].value)" style="font-size:11; color:white; background-color:rgb(144,60,96);">
 
 </form></td>


<td align=center><font size="2"/> Posted On 10/28/03</td><td align=center><font size="2"/> Book Is For <font color="#903c60"><b>SALE</b></font></td></tr>

<tr><td>   </td></tr><tr><td>    </td></tr><tr><td>    </td></tr><tr><td>    </td></tr>

                  <tr BGCOLOR='#ECE7E7'>
                  <td align=center> <font size="2"/>
 Physics For Scientists and Engineers 5th Edition</td><td align=center><font size="2"/>Raymond A. Serway and Robert J. Beichner</td>
                  <td align=center><font size="2"/> <font color="#903860"><b>$95</b></td><td align=center><font size="2"/>PCS125</td></tr>
                  <tr BGCOLOR="white"><td><font size="2"/> <i>Five books for PCS 125 and PCS 211 all for 1st year</i></td>


<td align=center><font size="2"/> <form name="myform"> <input name ="name" value = "Amar" type="hidden" /> <input name="address" value="*amarMurtza@hotmail.com" type="hidden"> <input type="button" value="CONTACT" onclick="setContent(this.form.address.value,document.forms[0].elements['name'].value)" style="font-size:11; color:white; background-color:rgb(144,60,96);">
 
 </form></td>


<td align=center><font size="2"/> Posted On 10/1/03</td><td align=center><font size="2"/> Book Is For <font color="#903c60"><b>SALE</b></font></td></tr>

<tr><td>   </td></tr><tr><td>    </td></tr><tr><td>    </td></tr><tr><td>    </td></tr>

                  <tr BGCOLOR='#ECE7E7'>
                  <td align=center> <font size="2"/>
 Physics for scientists & Engineers SOLUTION MANUAL</td><td align=center><font size="2"/>SERWAY BEICHNER</td>
                  <td align=center><font size="2"/> <font color="#903860"><b>$80</b></td><td align=center><font size="2"/>PCS125</td></tr>
                  <tr BGCOLOR="white"><td><font size="2"/> <i>SOLUTION MANUAL, EXCELLENT CONDITION</i></td>


<td align=center><font size="2"/> <form name="myform"> <input name ="name" value = "Os" type="hidden" /> <input name="address" value="*osaif@ryerson.ca" type="hidden"> <input type="button" value="CONTACT" onclick="setContent(this.form.address.value,document.forms[0].elements['name'].value)" style="font-size:11; color:white; background-color:rgb(144,60,96);">
 
 </form></td>


<td align=center><font size="2"/> Posted On 9/13/03</td><td align=center><font size="2"/> Book Is For <font color="#903c60"><b>SALE</b></font></td></tr>

<tr><td>   </td></tr><tr><td>    </td></tr><tr><td>    </td></tr><tr><td>    </td></tr>

                  <tr BGCOLOR='#ECE7E7'>
                  <td align=center> <font size="2"/>
 Physics for Scientist & Engineers</td><td align=center><font size="2"/>Serway Beichneer</td>
                  <td align=center><font size="2"/> <font color="#903860"><b>$80</b></td><td align=center><font size="2"/>PCS125211</td></tr>
                  <tr BGCOLOR="white"><td><font size="2"/> <i>5 volumes good conditon</i></td>


<td align=center><font size="2"/> <form name="myform"> <input name ="name" value = "ahsanzc" type="hidden" /> <input name="address" value="*achoudhu@ryerson.ca" type="hidden"> <input type="button" value="CONTACT" onclick="setContent(this.form.address.value,document.forms[0].elements['name'].value)" style="font-size:11; color:white; background-color:rgb(144,60,96);">
 
 </form></td>


<td align=center><font size="2"/> Posted On 9/12/03</td><td align=center><font size="2"/> Book Is For <font color="#903c60"><b>SALE</b></font></td></tr>

<tr><td>   </td></tr><tr><td>    </td></tr><tr><td>    </td></tr><tr><td>    </td></tr>

                  <tr BGCOLOR='#ECE7E7'>
                  <td align=center> <font size="2"/>
 Physics  (third edition, volume two)</td><td align=center><font size="2"/>R. Wolfson, J. M. Pasachoff</td>
                  <td align=center><font size="2"/> <font color="#903860"><b>$60</b></td><td align=center><font size="2"/>PCS110</td></tr>
                  <tr BGCOLOR="white"><td><font size="2"/> <i>Book in excellent condition </i></td>


<td align=center><font size="2"/> <form name="myform"> <input name ="name" value = "Danny" type="hidden" /> <input name="address" value="*king_kobra23@hotmail.com" type="hidden"> <input type="button" value="CONTACT" onclick="setContent(this.form.address.value,document.forms[0].elements['name'].value)" style="font-size:11; color:white; background-color:rgb(144,60,96);">
 
 </form></td>


<td align=center><font size="2"/> Posted On 9/11/03</td><td align=center><font size="2"/> Book Is For <font color="#903c60"><b>SALE</b></font></td></tr>

<tr><td>   </td></tr><tr><td>    </td></tr><tr><td>    </td></tr><tr><td>    </td></tr>

                  <tr BGCOLOR='#ECE7E7'>
                  <td align=center> <font size="2"/>
 Physics 3rd Edition Volume 2</td><td align=center><font size="2"/>Wolfson & Pasachoff</td>
                  <td align=center><font size="2"/> <font color="#903860"><b>$60</b></td><td align=center><font size="2"/>PCS110</td></tr>
                  <tr BGCOLOR="white"><td><font size="2"/> <i>Mint Condition, With Study Guide & CD-ROM</i></td>


<td align=center><font size="2"/> <form name="myform"> <input name ="name" value = "Brad" type="hidden" /> <input name="address" value="*bradtothemax@hotmail.com" type="hidden"> <input type="button" value="CONTACT" onclick="setContent(this.form.address.value,document.forms[0].elements['name'].value)" style="font-size:11; color:white; background-color:rgb(144,60,96);">
 
 </form></td>


<td align=center><font size="2"/> Posted On 9/10/03</td><td align=center><font size="2"/> Book Is For <font color="#903c60"><b>SALE</b></font></td></tr>

<tr><td>   </td></tr><tr><td>    </td></tr><tr><td>    </td></tr><tr><td>    </td></tr>

                  <tr BGCOLOR='#ECE7E7'>
                  <td align=center> <font size="2"/>
 Physics, 3rd Ed. Vol. 2</td><td align=center><font size="2"/>Wolfson and Pasachoff</td>
                  <td align=center><font size="2"/> <font color="#903860"><b>$100</b></td><td align=center><font size="2"/>PCS110</td></tr>
                  <tr BGCOLOR="white"><td><font size="2"/> <i>WITH STUDY GUIDE AND SOFTWARE</i></td>


<td align=center><font size="2"/> <form name="myform"> <input name ="name" value = "wshaikh" type="hidden" /> <input name="address" value="*wshaikh@scs.ryerson.ca" type="hidden"> <input type="button" value="CONTACT" onclick="setContent(this.form.address.value,document.forms[0].elements['name'].value)" style="font-size:11; color:white; background-color:rgb(144,60,96);">
 
 </form></td>


<td align=center><font size="2"/> Posted On 9/7/03</td><td align=center><font size="2"/> Book Is For <font color="#903c60"><b>SALE</b></font></td></tr>

<tr><td>   </td></tr><tr><td>    </td></tr><tr><td>    </td></tr><tr><td>    </td></tr>

                  <tr BGCOLOR='#ECE7E7'>
                  <td align=center> <font size="2"/>
 Physics with modern Physics for Scientists and Engineers</td><td align=center><font size="2"/>Richard Wolfson, Jay M. Pasachoff</td>
                  <td align=center><font size="2"/> <font color="#903860"><b>$ 80</b></td><td align=center><font size="2"/>PCS110</td></tr>
                  <tr BGCOLOR="white"><td><font size="2"/> <i>textbook is in excellent condition + study guide is included</i></td>


<td align=center><font size="2"/> <form name="myform"> <input name ="name" value = "db" type="hidden" /> <input name="address" value="*db_scorpio@hotmail.com" type="hidden"> <input type="button" value="CONTACT" onclick="setContent(this.form.address.value,document.forms[0].elements['name'].value)" style="font-size:11; color:white; background-color:rgb(144,60,96);">
 
 </form></td>


<td align=center><font size="2"/> Posted On 9/6/03</td><td align=center><font size="2"/> Book Is For <font color="#903c60"><b>SALE</b></font></td></tr>

<tr><td>   </td></tr><tr><td>    </td></tr><tr><td>    </td></tr><tr><td>    </td></tr>

                  <tr BGCOLOR='#ECE7E7'>
                  <td align=center> <font size="2"/>
 PHYSICS 3RD EDITION WITH MODERN PHYSICS</td><td align=center><font size="2"/>R.WOLFSON & J.PASACHOFF-ADDISON-WESLEY 1999</td>
                  <td align=center><font size="2"/> <font color="#903860"><b>$65</b></td><td align=center><font size="2"/>PCS110</td></tr>
                  <tr BGCOLOR="white"><td><font size="2"/> <i>WILLING TO NEGOTIATE PRICE, BOOK IN GOOD CONDITION</i></td>


<td align=center><font size="2"/> <form name="myform"> <input name ="name" value = "Kroopa" type="hidden" /> <input name="address" value="*kroopashah@yahoo.com" type="hidden"> <input type="button" value="CONTACT" onclick="setContent(this.form.address.value,document.forms[0].elements['name'].value)" style="font-size:11; color:white; background-color:rgb(144,60,96);">
 
 </form></td>


<td align=center><font size="2"/> Posted On 9/6/03</td><td align=center><font size="2"/> Book Is For <font color="#903c60"><b>SALE</b></font></td></tr>

<tr><td>   </td></tr><tr><td>    </td></tr><tr><td>    </td></tr><tr><td>    </td></tr>

                  <tr BGCOLOR='#ECE7E7'>
                  <td align=center> <font size="2"/>
 Grounding for the Metaphysics of Morals</td><td align=center><font size="2"/>Immanuel Kant</td>
                  <td align=center><font size="2"/> <font color="#903860"><b>$3</b></td><td align=center><font size="2"/>PHL503</td></tr>
                  <tr BGCOLOR="white"><td><font size="2"/> <i>Perfect Condition</i></td>


<td align=center><font size="2"/> <form name="myform"> <input name ="name" value = "Maya" type="hidden" /> <input name="address" value="*msaibil@ryerson.ca" type="hidden"> <input type="button" value="CONTACT" onclick="setContent(this.form.address.value,document.forms[0].elements['name'].value)" style="font-size:11; color:white; background-color:rgb(144,60,96);">
 
 </form></td>


<td align=center><font size="2"/> Posted On 9/5/03</td><td align=center><font size="2"/> Book Is For <font color="#903c60"><b>SALE</b></font></td></tr>

<tr><td>   </td></tr><tr><td>    </td></tr><tr><td>    </td></tr><tr><td>    </td></tr>

            </table>

            <p>
            1
                        <a href="/search.asp?search=physics&page=2">2</a>
                        
                  <a href="/search.asp?search=physics&page=2">[Next &gt;&gt;]</a>
                  
            </p>
            

</body>

</td>
</html>
cahge the ifram name to contact

<IFRAME name="contact" width="135" height="425">

try not to use things like main as object names or id's they can cause problems, main is not a reserved word but it is a key word
also all your forms have the same name this will cause errors

give each form a unique name eg myForm1 (get the 1 from the current row of the record set during output)

change your setContent function to this

function setContent(objForm,formaddress,name){  
    address = address.split("*");
    address = address.join("");
     strContent=strContent+ '<tr align="center" bgcolor="#ECE7E7"><td><font size="2" color="#903860">' + name + ' At <a href="mailto:' + address + '">' + address + '</font></td></tr>';
     results(objForm);
     }

and chnge the  call to

<input type="button" value="CONTACT" onclick="setContent(this.form, this.form.address.value,document.forms[0].elements['name'].value)" style="font-size:11; color:white; background-color:rgb(144,60,96);">
ASKER CERTIFIED SOLUTION
Avatar of James Rodgers
James Rodgers
Flag of Canada image

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
wo..so many changes, ok will have to change the following
no i dont work for ryerson is a independent student run site aimed primarily for ryerson students
worts linke a charm thanks
np... glad i could help

thanks for the points