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!

load (script/function) after login verification

Status
Not open for further replies.

atsea

Technical User
Feb 27, 2005
51
JP
Hello,

I have a webpage that contains (among other things) this;
Code:
			<div id="table1" class="table1">
			<script type="text/javascript">
				var cust = new Grid("Customer", 30, 10);
				cust.init(Def);
				cust.doAction();
			</script>
	  		</div>

The code above is resposible for defining and creating a table that displays customer info...

works great....everytime I open the webpage the table generates fine.

Now I have included a user login <div> and would like the table to be loaded only AFTER the user has been verified.

(note: I would like one page to handle all of this. for this reason I am using XMLHttpRequest to asynchronously verify the user)

within my login script I have a function that executes when a valid user is detected...looks something like this:

Code:
function login(){
      if (loggedIn){
		document.getElementById('username').disabled = 'disabled';
		document.getElementById('password').disabled = 'disabled';
		
		loginPanel.className = 'login2';
		collapseDiv('login_container');
      
       //I need to somehow execute the code (in the HTML above) here.  also the result must appear in that specific <div>

    }

Any suggestions would be greatly appreciated.

Thanks,

atsea
 
BillyRayPrachersSon (excellent handle),

The short answer to your question: No, it does not use document.write.

A couple of ways I've been looking into resolving this issue include:

DOM-Based On-Demand Javascript

and

XMLHttpRequest-Based On-Demand Javascript

examples can be found here: ]

I think I'm getting close...any suggestions?

Thanks for taking the time to look into this.

atsea
 
BRPS,

Sorry, I did not answer your question correctly...
(this forum doesn't allow me to edit my posts)

The answer is YES, document.write is used. Currently what happens is:
Object Grid is created.
then the Objects for Row, Col and Cell are created.
then a function generates HTML to represent the grid.
then document.write's it to the webpage.

Thanks,

atsea
 
If you can run the login function "in-line" with the output script, then simply put the output script inside your verificaiton code.

If you have to wait for page load, then you'll have to output the HTML to the container using .innerHTML or similar.

Hope this helps,
Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top