Jump to content

[SOLVED] switch statment running javascript function


adam291086

Recommended Posts

i have a simple switch statement

 

switch ($status)
{
case delete:
if(is_file($filename))
{
unlink($filename);
}
else
{
remove_dir($filename);
}
break;
case download:

break;

 

and in the case of download i want to include the javascript file

 

<script type="text/javascript" src="/admin/FTP/script/ftp.js"> and run the function call popup from there.

 

How can i do this?

simply echo that line of .js in your output, wherever you need it to go:

 

switch ($status) {
     case delete:
         if(is_file($filename)) {
             unlink($filename);
         } else {
     remove_dir($filename);
         }
         break;
     case download:
         echo "<script type='text/javascript' src='/admin/FTP/script/ftp.js'>";
         break;
}

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.