Kreso wrote on 16 jun 2004 in comp.lang.javas cript:
First of all I'm not a javascript programmer!
Second I repeat everything i said in my last post
Third if you don't know the solution or PLEASE do not reply to this
post
This code when saved as an *.asp file should show a link which, when
pressed, shows a dialog which should redirect the page to itself
including some data in the url
the only way i got the page to reload (with the data included in the
url) is to put document.write( "") (now commented) before the
location.href=. .. (or to manually refresh the page)
BEGIN CODE
<script language="javas cript">
<!--
function confirmDelete(x )
{
if (confirm("Klikn ite OK za brisanje. Cancel za povratak.")==tr ue)
{trans="test.as p?action=delete &nID="+x;
//document.write( "");
window.location .href = trans; }
}
//-->
</script>
<body>
<%
'//ASP CODE
if request("action ")="delete" then response.write request("action ")
%>
<a href="javascrip t:;" onclick="confir mDelete(15)">[obri¹i]</a>
</body>
END CODE
change this:
onclick="confir mDelete(15);"
to:
onclick="confir mDelete(15);ret urn false;"
Otherwise it is all a question of timing which process fires first
=============== =============== =============== ===
Furthermore you could clean up your code:
[
1 Superfluous is the testing if a boolean is true,
the result being the same as the original boolean]
2 The href="javascrip t:;" will not run if javscript is not active,
and it will not run if it is
]
=============== =============== =============== ====
<%@Language=vbs cript%>
<script type="text/javascript">
function confirmDelete(x ) {
if (confirm("Klikn ite OK za brisanje. Cancel za povratak."))
{
window.location .href = "test.asp?actio n=delete&nID="+ x;
}
}
</script>
<body>
Action:
<% = response.write request("action ") %>
<br>
ID:
<% = response.write request("ID") %>
<br>
<a href="#"
onclick="confir mDelete(15);ret urn false">
[obri¹i]</a>
</body>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)