Jump to content

[SOLVED] Multiple javascript commands


mike1313

Recommended Posts

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

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.