PDA

View Full Version : document.location.href is not execute without alert popup using java script



hb_venkatesh
Aug 6th, 2012, 05:10 PM
Hi Expert,

I have a problem for execute the hyperlink in javascript. When i have alert command in for loop "document.location.href " is execute properly , if i remove the alert command. it will not working.

Please adivce on the below script, how to over come this issue.

[CODE]

<script type="text/javascript">
function DoTheCheck(form)
{
for (i=0; i<document.forms["DetailBlock"].p_dmmy_box.length; i++)
{
if (document.forms["DetailBlock"].p_dmmy_box[i].checked==true)
{
alert("Checkbox at index "+i+" is checked!")
var p1=document.forms["DetailBlock"].p1.value;
var ps=document.forms["DetailBlock"].ps.value;
var p_stt=document.forms["DetailBlock"].p_dmmy_box[i].value;
var p_cpyno=document.forms["DetailBlock"].p_sttno[i].value;
var p_wccode=document.forms["DetailBlock"].p_wrtng_co[i].value;
document.location.href ="https://dev.xxx.com/x/test.load?p_key=Detail&p1="+p1+"&ps="+ps+"&pa1="+p_stt+"&pa2="+p_cpyno+"&pa3="+p_wccod
}
}
</script>

[ICODE]

Note: test.load is a stored procedure, which insert date in to temp table. And this should be execute in background only(Could not redirect from current page)

Thanks
Hb venki