Forum Moderators: open

Message Too Old, No Replies

document.location.href

         

strings

5:25 am on Jun 6, 2008 (gmt 0)

10+ Year Member



on submitting the form i am calling the javascript function. The function is getting called, the problem is document.location.href is not working .
plz anyone get some solution.

<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">
function mailno($no, $textname)
{
alert("functi called") ;
document.location.href="http://www.yahoo.com";
}
</SCRIPT>

thks
amit.

daveVk

7:25 am on Jun 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The form submit will result in a page request probably overwriting your javascript requist. Put the javascript in the submit reply page, or could try tartgeting submit to different window ?

Dabrowski

3:51 pm on Jun 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think DaveVk is right, if you stick a false return it should cancel the form submittal so your manual redirect will work.

function mailno($no, $textname)  
{
alert("functi called") ;
document.location.href="http://www.yahoo.com";
return false;
}

penders

2:58 pm on Jun 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



But also, document.location.href should be window.location.href, as rocknbil states in this duplicate thread:
[webmasterworld.com...]