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

Diplaying results in a div tag

Status
Not open for further replies.

Astor

Programmer
Jul 3, 2002
12
ES
Hi,

I have the following code

<html>
<head>
<script language=&quot;javascript&quot;>
function reptitle(title) {
ReptName = title;
if (ReptName == null) {ReptName = &quot;My Pages&quot;;}
RespName = &quot;Myself&quot;;
document.write(ReptName + ' - ' + RespName);
return;
}
</script>
</head>
<body>
<a href=&quot;#&quot; onClick=&quot;reptitle('My Pages');&quot; target=&quot;reptype&quot;>Click</a>
<div id=&quot;reptype&quot;></div>
</body>
</html>

I do get the data displayed. The problem is that I want it displayed underneath the link. Currently when you click on the link and it disappears and gives me the result. I want to stay in the same window and get the results displayed within the div called &quot;reptype&quot;.

I'm sure it's something simple I'm missing here, but any help will be appreciated.

Thanks in advance.
 
this will work for all modern browsers IE4 or 5+, NS6+, Moz 1+:

function reptitle(title) {
ReptName = title;
if (ReptName == null) {ReptName = &quot;My Pages&quot;;}
RespName = &quot;Myself&quot;;
document.getElementById(&quot;reptype&quot;).innerText = (ReptName + ' - ' + RespName);
return;
}
=========================================================
if (!succeed) try();
-jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top