Results 1 to 2 of 2

Thread: Javascript function call in a php function problem

  1. #1
    iuliser Guest

    Javascript function call in a php function problem

    Hello. I tried to write a script that rotates two different pictures, each of them asociated with different url. I want to use this for more pairs of pictures. I made two javascript functions, one of them called in a php function. I'm new to javascript and I don't know where is the mistake I made, so I hope you can help me. The Javascript sequence is:

    Code:
    <script language="javascript" type="text/javascript">
    seconds = "2";
    function imgOne11(id,address1,address2,name1,picture1,picture2)
    {
    document.getElementById(id).innerHTML = '<a href="'+address1+'" target="_blank" ><img src="'+picture1+'" name="'+name1+'" border=0 /></a>';
    setTimeout("imgTwo11(id,address1,address2,name1,picture1,picture2)", seconds * 1000);
    }
    function imgTwo11(id,address1,address2,name1,picture1,picture2)
    {
    document.getElementById(id).innerHTML = '<a href="'+address2+'" target="_blank"><img src="'+picture2+'" name="'+name1'" border=0 /></a>';
    setTimeout("imgOne11(id,address1,address2,name1,picture1,picture2)", seconds * 1000);
    }
    </script>
    and the php function is:

    PHP Code:
    function imagine_partener2($address1,$address2,$tit,$picture1,$picture2,$idsp,$name1)
     {return 
    "<span id='$idsp'> <a href='$address1' target='_blank'> <img src='sponsori/$tit' name='$name1

    onLoad=\"imgOne11(
    $idsp,$address1,$address2,$name1,$picture1,$picture2)\" style='width:170px;'/> </a></span>";

    Thank you!

  2. #2
    Join Date
    Apr 2009
    Location
    The toon
    Posts
    1,225
    your variable....

    seconds = "2";

    is out of scope.

    try this...

    var seconds = "2";

Similar Threads

  1. mssql connect to php:Call to undefined function mssql_connect()
    By newphpbees in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 30 Sep 2010, 03:08 AM
  2. Call javascript function with parameter using XSLT
    By beezleboss in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 26 Jan 2010, 11:21 AM
  3. Javascript calling PHP function
    By beyondthegrave in forum General Questions
    Replies: 1
    Last Post: 26 Oct 2007, 04:02 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •