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

Useing document.write to dynamicly write to current page?

Status
Not open for further replies.

NJDrew

Technical User
Dec 21, 2001
31
US
I’m not sure if the title means what it does in my head :) ,but basically I have a loaded page, upon an action I am calling a function which I want to write thumbnail images, to a specific td.

This piece of my code:

Code:
<head>
<style type="text/css">
#row {
    position:center;
    height:125px;
    width:630px;
    overflow:auto;
    white-space:nowrap;
     }
</style>
<script language="Javascript">
function dow1(s) {
i=1;
b=1;
while(i<=50){
document.thumbstrip.write("<a href='#' OnMouseOver='newMap("+b+")'><IMG SRC='"+b+"t.JPG'></img></a>");
i++;
b++;
}
document.write("</div>");
}

function newMap(y) {

document.de.src= y+".jpg";
}
</script>
</head>
<body>
<table>
    <tr>
      <img name=de  src="Logo.jpg" align="center" vspace=10>
    </tr>
    <tr>
        <div id="row">
        <td name="thumbstrip">

        </td>
        </div>
    </tr>
</table>
<input type="button" onClick="dow1()" value="Click Here"></input>
</body>

Thats the simplified version of my problem. Thanks in advance for your thoughts. Drew

&quot;Mistakes are the portals of discovery&quot;
James Joyce
 
I'm not sure if you can "name" a <td> or use the write function like this, but you can try another way:

Code:
<html>
<head>
<style type="text/css">
#row {
    position:center;
    height:125px;
    width:630px;
    overflow:auto;
    white-space:nowrap;
     }
</style>
</head>

<body>
<table>
    <tr>
      <img name=de  src="Logo.JPG" align="center" vspace=10>
    </tr>
    <tr>
        <div id="row">
        <td>
        <div id="thumbstrip">
        </div>

        </td>
        </div>
    </tr>
</table>
<input type="button" onClick="dow1()" value="Click Here"></input>

<script language="Javascript">
function dow1()
{
	i=1;
	b=1;
	while(i<=50)
	{
		thumbstrip.innerHTML += "<a href='#' OnMouseOver='newMap("+b+")'><IMG SRC='"+b+"t.JPG'></img></a>" + i + "<br/>";
		i++;
		b++;
	}
}

function newMap(y)
{
	document.de.src= y+".JPG";
}
</script>
</body>

</html>

vlad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top