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

how to clear screen and display new stuff

Status
Not open for further replies.

Candyb

Technical User
Oct 2, 2001
12
0
0
CA
Hi,

I have this document where I am displaying a pulldown list and a list of items with buttons that lead to detail pages.
I create a javascript function where the button go to this function and uses document.write to display the details.

but, I was wondering how to clear the screen and then write something on the screen from within the javascript fucntion.

below is my script: I want to clear the current screen after the button is clicked , keep my pull down list available but clear all old content and replace with new content. new content is the msxml object.

my pulldown list is just simple html.
Thanks,
Candy

<SCRIPT>
function showDetail(tip_id)
{
var display = document.list.display.value;
var detailXSL = new ActiveXObject(&quot;MSXML2.DOMDocument&quot;);
detailXSL.async=false;
detailXSL.load(display);
var nodes = tipsheetXML.selectSingleNode(&quot;tipsheets/tipsheet[@tip_id='&quot; + tip_id + &quot;']&quot;);

document.write(nodes.transformNode(detailXSL.documentElement));
}
</SCRIPT>
 
<!--
Hi
Run this script, it is a simple version of what you want to do I think, I would explain it but I just started looking at it a few minutes ago, but it doesnt look too bad.
-->

<HEAD>

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!-- Begin
function createForm(number) {
data = &quot;&quot;;
inter = &quot;'&quot;;

if (number < 16 && number > -1) {
for (i=1; i <= number; i++) {
if (i < 10) spaces=&quot; &quot;;
else spaces=&quot; &quot;;
data = data + &quot;URL &quot; + i + &quot; :&quot; + spaces + &quot;<input type='text' size=10 name=&quot; + inter + &quot;url&quot; + i + inter + &quot;'><br>&quot;;
}
if (document.layers) {
document.layers.cust.document.write(data);
document.layers.cust.document.close();
} else {
if (document.all) {
cust.innerHTML = data;
}
}
} else {
window.alert(&quot;Please select up to 15 entries.&quot;);
}
}

// End -->
</script>
</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document -->

<BODY>
<center>
<form name=counter>
Number of URLs to enter:
<input type=text name=number size=5 onblur=&quot;createForm(counter.number.value);&quot;>
</form>
<br>
<form name=&quot;webform&quot;>
<table border=0>
<tr valign=top>
<td>Name:</td>
<td><input type=text size=20 name=name></td>
</tr>
<tr>
<td colspan=2>
<!-- Placeholder for dynamic form contents -->
<span id=cust style=&quot;position:relative;&quot;></span>
</td>
</tr>
<tr valign=top>
<td>Comments:</td>
<td><textarea name=comments cols=45 rows=5 wrap=virtual>
</textarea></td>
</tr>
<tr>
<td></td>
<td><input type=submit value=&quot;Send&quot;></td>
</tr>
</table>
</form>
</center>

<p>
<center>
<font face=&quot;arial, helvetica&quot; size=&quot;-2&quot;>Free JavaScripts provided<br>
by <a href=&quot; JavaScript Source</a></font>
</center>
<p>

<!-- Script Size: 1.95 KB -->
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top