Welcome to WebmasterWorld Guest from 107.21.183.163

Forum Moderators: open

Message Too Old, No Replies

Form submit opens two pages but not in chrome or safari

Can anyone help?

     

shadowlight

7:36 pm on Apr 18, 2013 (gmt 0)



ok, I have some javascript code that enables one html form to open two pages on submit, one in the same window and the other in a new window. This works fine in IE and FF although not in Chrome or Opera.

Can anyone shed any light on this? Here is the code:

echo '<script language="Javascript" type="text/javascript">
function OnButton5()
{
document.getElementById(\'form_name\').action="urlopen1.php"

document.getElementById(\'form_name\').target="_blank";

document.getElementById(\'form_name\').submit();

return true;
}

function OnButton6()
{
document.getElementById(\'form_name\').action="urlopen2.php"

document.getElementById(\'form_name\').target="_self";

document.getElementById(\'form_name\').submit();

return true;
}
</script>';


The actual code as part of the html form which calls these javascript functions is this:

onclick="OnButton5(); OnButton6();"


Can anyone give any advice on how to make this cross browser compatible in order to work in chrome and safari as well as IE and FF.

TIA

Jen1

2:41 am on Apr 29, 2013 (gmt 0)



That is an interesting issue, I saw the same thing happening to me.
I tested this and it should work for you in multiple browsers.

change your onclick to:
onclick="javascript:OnButton5();"

and add this to OnButton5() function...
setTimeout("OnButton6();",500);

LisaMugal

12:04 pm on May 2, 2013 (gmt 0)



s
 

Featured Threads

Hot Threads This Week

Hot Threads This Month