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

Alert Box

Status
Not open for further replies.

Sitehelp

Technical User
Joined
Feb 4, 2004
Messages
142
Location
GB
Any ideas how you create an alert box with PHP or is that just javascript, if so how do I make my php code bring up a javascript alert box on clicking submit: I have the javascript code for it as:

<script>
<!-- Hide Script
alert(&quot;On clicking OK your call will be deleted!&quot;)
//End Hide Script-->
</script>

I cannot combine this with my form:

<form action=&quot;&quot; method=&quot;post&quot; name=&quot;CallID&quot; id=&quot;CallID&quot;>
<div align=&quot;center&quot;>
<p><strong>Call ID: </strong>
<input name=&quot;CallID&quot; type=&quot;text&quot; id=&quot;CallID&quot;>

</p>
</div>
</form>

This form also uses some PHP declared earlier to delete a record in the DB. Any ideas how I get this alert box to appear on submit. Cheers all!
 
Code:
<script>

function oAlert(){
      alert(&quot;Your text&quot;)
}

<form action=urpage.php method=post onSubmit=oAlert>

gd luck!



Martin

Computing help and info:

 
Cheers! I have put that function at the top of all the code as:

<script>

function oAlert(){
alert(&quot;On clicking ok your call will be deleted&quot;)
}

and within the submit button itself I have put:

onClick=&quot;oAlert()&quot;

but its asking me if I want to debug, indicating an error, then I say no to it and it brings up the page and when I click the call I want to delete it just deletes like normal without showing the alert box, what am I doing wrong.....cheers!
 
Ignore this all is sorted! anyone who wants to know its:

<script>
<!-- Hide Script
function doConfirm() {
return confirm(&quot;YOUR TXT HERE
}

Then just call this Javascript up in the form like:

onsubmit=&quot;return doConfirm();

Cheers for your help!
 
gd. you could have it so it cancels if they click no instead of yes!

<script>
function yesNo(){
if(confirm(&quot;On clicking ok your call will be deleted&quot;){
do something if they clicked yes
}else{
do something if they clicked yes
}
</script>

Martin

Computing help and info:

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top