Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Javascript Confirmation Question


conrad10781

Recommended Posts

Right now I'm trying to have a link that passes a parameter from a php array, that before it executes has a javascript popup confirmation box. I've tried to do it a few times, but the quotes keep delimiting each other in different languages and I'm not sure how to get around this.

 

currently my link looks something like this:

<?php echo'

<a onclick="If window.confirm(document.location='asdf.com?id=' . $dataArray[$index] . ' ">';

?>

blah blah

</a>

 

I think I'm making this a lot harder than it needs to be...

Link to comment
Share on other sites

That's my current code and it's still not working :-/

 

<?php echo'

<a onclick="If window.confirm(document.location=\'pay_commission.php?skin_id=' . $products['id'] . '\'">';

 

 

if($products['commission_total'] >= 50){

echo "<b>Payment Due</b>";} else {

echo "No Payment Due"; }

?></a>

Link to comment
Share on other sites

Now your PHP syntax looks correct, but you have a least one obvious Javascript syntax error.

 

You never close this function:

 

window.confirm(

 

Look at your HTML source to see what the printed Javascript looks like. This will help you determine your JS errors.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

wow, I'm going blind...

 

 

Yeah, I'm not even sure how to answer you 'cause I can't even tell what's supposed to be happening.

 

You will need an href to get a clickable link. And I'm not sure what you expect to happen with window.confirm(document.location='pay_commission.php?skin_id=1').

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

yeah, I got it working fine... you can use text as a link in just an onclick. I didn't realize until I just looked at it I was trying to confirm the url I was going to instead of having a message... yikes I'm going home before I lose my mind. Thanks for all the help however, you're a super duper guy.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...