Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 09-20-2011, 09:54 AM
ScriptMan's Avatar
ScriptMan ScriptMan is offline
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 14,038
iTrader: 4 / 100%
A little help understanding JS

I never use JS but for some reason I decided to use it for an action confirmation. I found a working script over at WC3 and tried to modify it for my use but I can not figure out how to call the action required. The script is working fine. I just can't make it go to link.

It is a confirmation before deletion of a DB entry.

In the doc head I have:

PHP Code:
<script type="text/javascript">
function 
Delete()
{
var 
r=confirm("Do you really want to delete this image?");
if (
r==true)   { alert(  "hello"   ) ;   }
else   {   exit;   }
}
</script> 
On the page body I have:
PHP Code:
echo "<br><input type='button' onclick='Delete()' value='Delete Image'>"
What I want the script to do is function like the PHP href link after the confirmation button is clicked. I assume I need to replace the
PHP Code:
alert(  "hello"   ) ; 
with something but I can not seem to get the syntax right.

The working fine, with no confirmation, PHP link code is shown below. Obviously .$->id is a page variable.

PHP Code:
  echo "<br><a href='delete.php?id=" $a->id."'><B>Delete</B></a><br>"

Would really appreciate any help you guys can offer because I am about this close - to doing server side with PHP.
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 09-20-2011, 11:29 AM
Dan Williamson Dan Williamson is offline
The Controversial Coder
 
Join Date: 05-01-06
Location: Manchester; UK
Posts: 2,710
iTrader: 0 / 0%
Do you want to do something like this?
 
Reply With Quote
  #3  
Old 09-20-2011, 01:15 PM
ScriptMan's Avatar
ScriptMan ScriptMan is offline
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 14,038
iTrader: 4 / 100%
Quote:
Originally Posted by Dan Williamson View Post
Do you want to do something like this?
That might be tweakable. I'll let you know.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Not understanding backlinking?? searchenvision SEO Forum 13 10-13-2010 04:08 AM
Need help understanding low contrast gizelle Graphic Design Forum 7 03-31-2008 09:09 AM
Understanding the DNS System discountdomains Domain Name Forum 2 09-30-2004 06:57 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 04:24 PM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC