Click to See Complete Forum and Search --> : putting asp variables into a javascript


voske
05-14-2003, 08:49 AM
Hi,

what i'd like to do: if you click on the image then an alert comes up. If you answer yes, that particular record should be deleted otherwise nothing happens

the javascript works, but I'm sent to the page www.boekenzoeker.be/test/deletebook.asp/BoekId=Boeknum , but boeknum should be a number like 10

head:
function rusure(BoekNum)
<script>
{
question = confirm("Are you sure?")
if (question !="0"){
top.location = "../test/deletebook.asp?BoekId=BoekNum"
}
}
</script>

body:
<td><div align="center"><font size="2"><a href="" onClick="rusure(<%=ShowBook("BookId")%>); return false;"><div><img src=info.gif width=13 height=23,3></div></a></font></div></td>

i also tried without the quotes in bookid but that also doesn't work. or is there another way? can i use a MsgBox like in VBA and do it that way?

Thanks

cmelnick
05-14-2003, 10:40 AM
I think you want the following:


<script language="Javascript">
function rusure(BoekNum) {
if (confirm("Are you sure?"){
top.location = "../test/deletebook.asp?BoekId=" + BoekNum;
}
}
</script>


in place of the script you have.

voske
05-14-2003, 11:35 AM
It was the +Boeknum indeed instead of the &Boeknum i tried to.
that's great
thanks a lot
Dimitri