Jump to content

confirm box with spinner and anchor


matthewst

Recommended Posts

My php page has a spinner on it:

<script> 
function spin( obj ) 
{ 
var spinner = document.getElementById( obj ); 
var spinner_content = document.getElementById( obj+"_body" ); 
if ( spinner_content.style.display == 'block' ) // this line
{ 
spinner.innerHTML = '+'; 
spinner_content.style.display = 'none'; // this line
spinner_content.style.height = '0px'; 
spinner_content.style.margin = '0px'; 
} 
else 
{ 
spinner.innerHTML = '-'; 
spinner_content.style.display = 'block'; // this line
spinner_content.style.height = 'auto'; 
spinner_content.style.margin = '20px 0px 20px 50px'; 
} 
} 
</script>

 

I have an anchor at start_spinner:

<?php start_spinner( 'up_order_spin', "Table Order Form" );?>
									<a name="tableorderform"></a>
									<table align="center">

 

When my users click submit...:

<input type="submit" name="submit" class="formTextbox" value="Submit" onclick="go_there()">

 

...a box pops up that asks if they want to fill out an order form...

<SCRIPT language="JavaScript">
<!--
function go_there()
{
var where_to= confirm("Did you fill out the Table Order Form?");
if (where_to== false)
{
   window.location="http://www.mysite.net/mypage2.php#tableorderform";
}
else
{
  window.location="http://www.mysite.net/projects.php";
  }
}
//-->
</SCRIPT>

 

...no matter what they click they are taken to projects.php.

 

What I need is: If they click "OK" they go to projects.php, but if they click "Cancel" then stay at mypage2.php and the spinner opens for them.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.