Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Javascript events

Javascript events

Javascript events

I've been wracking my brain for quite a while so I figured I'd reach out to you guys. Here's what I'm trying to do:

1. I have a button that will perform a database lookup using remote scripting.
2. While it is doing all of this, I want an element that has "Please Wait --- Uploading Data" to become visible, or its value to change from "" to "Please Wait --- Uploading Data" so the user can see it.
3. When the process is finished, I want toe <span> to become invisible.

It seems that no matter what I do, no text changes or no display attributes changes until the very end so there is effectively no change to anything!! I currently have the following:

function Update_PLS_Wait ( strValue )
alert ( document.getdata.PLS_Wait.value );
document.getdata.PLS_Wait.value = strValue;
alert ( document.getdata.PLS_Wait.value );
return true;

function getApparatusName_via_VLICK ()

Inside my form:
<td align=center colspan=2>
<input type="button" name = "clicker1" class="Submit_Button" value = "Lookup Items" onClick = "Update_PLS_Wait ( 'Please wait --- Uploading data' ); getApparatusName_via_CLICK (); Update_PLS_Wait ( '' );">
<tr><td align=center colspan=2><input type = "TEXT" name = "PLS_Wait" id = "PLS_Wait" size="30" maxlength="30" value="" readonly></td></tr>

The crazy thing is that the alerts inside "Update_PLS_Wait ( strValue )" happen but I am unable to see the textbox change when I close the alert()

This issue is the same regardless of whether I have a text element that I change or a span where I change the display property like ( which I wanted in the first place):

<td align=center colspan=2>
<input type="button" name = "clicker1" class="Submit_Button" value = "Lookup Items" onClick = "Update_PLS_Wait ( 'block' ); getApparatusName_via_CLICK (); Update_PLS_Wait ( 'none' );">
<tr><td colspan=2><span id="PLS_Wait" name="PLS_Wait" STYLE="display:none">Please wait --- Uploading data</span></td></tr>

Then the Update_PLS_Wait () function would change to this:

function Update_PLS_Wait ( strDisplay )
var obj = document.getElementById ( "PLS_Wait" );
obj.style.display = strDisplay;

return true;

Thanks in advance,

Jerry Scannell

RE: Javascript events

Here's a working example of what you're trying to do. Hopefully you can use this more modern take on Javascript which uses `const` keyword, the `querySelector` method, and event listeners:

If the HTML is as such:

CODE --> html

<span id="waitMessage">initial text</span>
<input id="aparatusNameButton" type="button" class="Submit_Button" value="Lookup Items"> 

Then the Javascript can be thus:

CODE --> javascript

const waitMessageSpan = document.querySelector('#waitMessage');

const aparatusNameButton = document.querySelector('input#aparatusNameButton');
aparatusNameButton.addEventListener('click', getApparatusName);

function getApparatusName() {

	waitMessageSpan.innerText = 'Please wait --- Uploading data';


	// ...

	waitMessageSpan.style.display = 'none';

Here is a jsfiddle of the working example: https://jsfiddle.net/kb2yxfLa/3/

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close