SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Zealot amit290's Avatar
    Join Date
    Oct 2001
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    hyperlink - JS function & PHP variable

    Hi,

    Was wondering (/desperate ;-) to know if its possible to call a JavaScript function and pass on a PHP variable in 1 hyperlink?

    I need to pass on variable: $lang=english
    And call JavaScript Function: javascript:loadScript1()

    possible?

    Thanks

  2. #2
    ********* obeah makeda's Avatar
    Join Date
    Jun 2001
    Location
    rollin' on dubs
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes, its possible if you "write" out the php variable ahead of time. ex:

    <script language="javascript" type="text/javascript">
    function passParam() {
    var sPHPVariable;
    sPHPVariable = "<?=$lang ?>";

    //not sure what you want to do but it would go here

    }
    </script>

    <a href="#" onClick="passParam()">


Bookmarks

Posting Permissions

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