...

View Full Version : Alert function to print not working



BH8orzAsp
03-18-2005, 08:33 PM
Hi, sorry i know this has been covered time and time again but after hours of looking at previous coding examples i just couldn't figure out how to make mine work! ( ARG! ) so i have a button on my page that invokes a script to alert the user to ask if they wish to print... then i wish to redirect them to another page... ( i havnt bothered putting in my redirect yet as i havnt gotten the alert to pop-up in the first place )

<script language="javascript">
function Addnew()
{if (confirm("if you would you like to Print the book information press ok, if not press cancel"))

window.print();

-(this is where i'll redirect)-

}
else{

-(this is where i'll redirect)-

}

</script>

...
(page's code)
...

<input type="button" name="AddNew" value="Add New" onclick="Addnew()" >

------

i just dont see what im doing wrong... Thanks in advance :thumbsup:

Brandoe85
03-18-2005, 10:08 PM
Something like this?


<html>
<head>
<script type="text/javascript">
function ask()
{
var choice = confirm("if you would you like to Print the book information press ok, if not press cancel");
if(choice)
{
alert("ok");
}
else
{
alert("cancel");
}
}

</script>
</head>
<body>
<form action="" method="">
<input type="button" name="click" value="Print" onclick="ask();">
</form>
</body>
</html>

BH8orzAsp
03-21-2005, 03:50 PM
Thanks a crapload Brando :) :thumbsup: -- sorry this took a while to respond, i only work on my coding mon -> fri @ school....



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum