Solved

Dynamically update <div> while asp script is looping using response.flush

Posted on 2008-09-29
4
929 Views
Last Modified: 2011-10-03
I sort of did this before, but it doesn't work right and I want to start from scratch.  I have attached some pseudo code, and I would appreciate someone telling me how to make it update the div tag at the top with the MACHINENAME it is currently scanning.  I am using ASP.
<html>

<body>

<div id="loading">Now scanning MACHINENAME</div>

<table>

  <tr>

    <td>Name</td>

    <td>IP addrss</td>

  <tr>

  LOOP

    Ping MACHINENAME

    <tr>

       <td>MACHINENAME</td>

       <td>MACHINEIP</TD>

    </tr>

  ENDLOOP

</table>

</body>

</html>

Open in new window

0
Comment
Question by:Cerixus
  • 3
4 Comments
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 22602889
ASP is a web server language.  As a remote web application, it should have no access whatsoever to a user's local machine.  To do this is a violation of the sandbox model of web code, that it should not be able to intrude on or gather information from any person's local computer.  Any code you generate in this way will only be microsoft specific, and only for those people dumb enough to allow active-X controls to invade their own privacy.  This will never work on any browser other than IE, and thank goodness it won't.  The last thing I and most other people want is a web site finding out what computer we are running.

Anyway, to do this, look into active -X controls and hope everyone is running IE with a wide open system.
0
 
LVL 1

Author Comment

by:Cerixus
ID: 22606467
You are totally misunderstanding what I want.

Ignore the machine name thing.

Just pretend it's looping through records in a database.  I want something that shows what record it is currently on.  Like at the top of the page I want it to say "Now scanning XXX...", then when it loops to the next item it will update to say "Now scanning YYY...".
0
 
LVL 1

Author Comment

by:Cerixus
ID: 22608593
I tried an iframe approach.  At the top of my page, I have this:

                 Status: <iframe src="status.asp?status=Loading..." name="status"></iframe>


Then, in the loop I have this:

      currentName = arrTXT(intTXT)
      Response.Write("<script>window.open('status.asp?status=" & currentName & "','status');</script>")
      response.flush

Oddly, the iframe never appears until it finishes the report, at that time it does display the proper information (the last piece of data).  however, if you watch the browseres status bar, you can see it referencing status.asp and passing the proper variables.

Help
0
 
LVL 1

Accepted Solution

by:
Cerixus earned 0 total points
ID: 22608946
Got it!

At the top of my page, I have this:

     <div id="statusTest"></div>

In the loop I have this:

           Response.Write("<Script>document.getElementById('statusTest').innerHTML = '" & currentName & "';</script>")
      response.flush

That's it!  Must have misplaced a quote when I tried it the first time...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Making my existing website "mobile friendly"... 10 36
Angular 2 - Issue in page Layout 2 48
Popup to change image and store url in database 2 31
Javascript Hashmap output 8 47
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now