mike1313 Posted December 5, 2007 Share Posted December 5, 2007 Is it all all possible to get both the CloseMessage(); and displayMessage(); to work on the same onclick event? <a href=# onclick=closeMessage()&&displayMessage('page.php');return false>Add</a> All I know is that it doesn't work as is. Any help is appreciated. Link to comment https://forums.phpfreaks.com/topic/80238-solved-multiple-javascript-commands/ Share on other sites More sharing options...
rajivgonsalves Posted December 5, 2007 Share Posted December 5, 2007 Yes use a semi-colin as you did with the return statement <a href="#" onclick="closeMessage();displayMessage('page.php');return false">Add</a> Link to comment https://forums.phpfreaks.com/topic/80238-solved-multiple-javascript-commands/#findComment-406696 Share on other sites More sharing options...
mike1313 Posted December 5, 2007 Author Share Posted December 5, 2007 Alright is there an alternative method? Because sadly that still does not work. Also both the closeMessage() and displayMessage() work apart from one another but once I combine them. Nothing. Link to comment https://forums.phpfreaks.com/topic/80238-solved-multiple-javascript-commands/#findComment-406715 Share on other sites More sharing options...
rajivgonsalves Posted December 5, 2007 Share Posted December 5, 2007 can you post your code ? what are you trying to acheive from these functions Link to comment https://forums.phpfreaks.com/topic/80238-solved-multiple-javascript-commands/#findComment-406718 Share on other sites More sharing options...
phpQuestioner Posted December 6, 2007 Share Posted December 6, 2007 encapsulate both functions into one and use a setTimeout for each function. like so: <script language="javascript"> function closeMessage() { // functions contents here } function displayMessage(url) { // functions contents here } function loadBothMyFunctions() { setTimeout("closeMessage()", 100) setTimeout("displayMessage('page.php')", 200); } </script> <a href="javascript:void(0)" onclick="loadBothMyFunctions()">Add</a> Link to comment https://forums.phpfreaks.com/topic/80238-solved-multiple-javascript-commands/#findComment-407398 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.