Hi i have this script which has a submit button what the javascript does is if user doesnt select an option from the drop down menu an alert pops up saying (select tv option) The problem is it works fine all al browsers except on safari if the user select one option and (click here to view) the new page opens on a new new tab now if you try to select a new option again and click the the submit button (click here to view) it doesnt work on second selection it the issue seems to be only on safari all other browsers work fine please help my site is this one http://www.estateagentsonfilm.co.uk/builders.php the drop down is the (select tv agent drop down ) then click here to view if you try select and click twice doesnt work only on safari this my javascript <script type="text/javascript"> function checkAgent() { if (document.getElementById('agent_select').value=='none') { alert('Select Web TV'); return false; } return true; } </script> Code (markup): the form that calls the script form id="agents" action="agents_jump.php" onsubmit="return checkAgent();" method="post" target="_blank" name="agents" style="margin:0;"> PHP:
Hi i thsi is a simple example of my issue if you test this script on safari by selecting the from the drop down twice you'll notice that second time it doesnt work but if you test on a differnt browser it works any help would be much appreciated <html> <head> <script type="text/javascript"> function checkAgent() { if (document.getElementById('agent_select').value=='none') { alert('Select Web TV'); return false; } return true; } </script> </head> <body> <form id="agents" action="agents_jump.php" onsubmit="return checkAgent();" method="post" target="_blank" name="agents" style="margin:0;"> <select name="agents" id="agent_select" size="1" style="width:160px; font-size:13px;">> <option value="none">Volvo</option> <option>Saab</option> <option>Mercedes</option> <option>Audi</option> </select> <input class="view_agents" id="tvoption" type="image" src="images/viewagents.gif" alt="TV OPTION" name="tvoption" border="0" onclick="jwplayer().stop();"> </form> </body> </html> PHP:
might be a Safari bug, what i can suggest to you is to reload the page on submit maybe after a few seconds.. <script type="text/javascript"> function checkAgent() { if (document.getElementById('agent_select').value=='none') { alert('Select Web TV'); return false; } setTimeout(function(){ location.reload(); },2000); // page will reload after 2 seconds return true; } </script> HTML:
Hi the this setTimeout(function(){ location.reload(); just one problem before i used to have when submit (onclick="jwplayer().stop() now i tried to implement the jwplayer sto function next to the set timeout but doesnt work. like this setTimeout(function(){ location.reload(); jwplayer().stop(); },2000); // page will reload after 2 seconds return true; } Code (markup): have i got the line wrong or that is not realistic way to do it?
setTimeout(function(){ [COLOR=#ff0000]location.reload()[/COLOR]; [COLOR=#008000]jwplayer().stop()[/COLOR]; },2000); Code (markup): Once the red part executes, the green part is no longer in memory, so it doesn't do anything. setTimeout(function(){jwplayer().stop(); location.reload();},2000); Code (markup): may do it.