I want to create a button to be executed and produce: a warning and if the click OK to go to another page. look at my javascript code, I've made ​​but I do not know where to put such a target="_blank", anyone please help me. thanks.

<script language="JavaScript">alert('Thanks');	document.location='kuitansi.php?id=<?php echo $IDc; ?>'</script>

target="_blank" belongs in the HTML.

If I understand correctly, you want something like this:

<a href="kuitansi.php?id=<?php echo $IDc; ?>" target="_blank" onclick="return confirm('Go to '+this.href)+' ?'"></a>

The confirm() statement works as follows:

  • If user clicks 'OK' then true is returned and the hyperlink action is allowed.
  • If user clicks 'Cancel' then false is returned and the hyperlink action is suppressed.

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.