Re: calling JS function from php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



suresh kumar wrote:

I am facing one problem in my project.I am trying to call a javascript function from php.but it not executing.this is my code.
function clientTime() { var cNow = new Date();
       var cHour = cNow.getHours();
      var cMin  = cNow.getMinutes();
      var hour= cHour + ":" + cMin;
      return hour;
      } //End function clientTime
     function clientDate() {
            var cDate  = new Date();
     var clientYear = cDate.getFullYear();
     var clientMonth = cDate.getMonth();
     var clientDay   = cDate.getDate();
     var year= clientYear + "-" + clientMonth + "-" + clientDay;
     return year;
} //End function clientDate
<? print "<span style=padding-left:14.2cm><font size=2 face=Arial color=#555555><script type=\"text/javascript\">";
       print "clientTime()";
       print "clientDate()</script></font></span>"; ?>
i need help from u.

				
---------------------------------
 Yahoo! India Answers Share what your know-how and wisdom
Send free SMS to your Friends on Mobile from your Yahoo! Messenger Download now
Hi Suresh

Unfortunately you cannot call a javascript function from directly within php. What you are doing is generating a web page that has invalid javascript. Try looking at your output with "view source" for clues.

Ryan


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux