#1
  1. No Profile Picture
    wizz@linux.be
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    belgium
    Posts
    30
    Rep Power
    13

    Question php in javascript function?


    Hi, i'm trying to setup a bunch of links that change content in multiple frames. Therefor i wrote a little bit of javascript that comes down to this function:

    <SCRIPT language="JavaScript">
    <!----hide
    function change2()
    {
    parent.mainFrame.location="thumbs.php";
    parent.right_frame.location="page4.htm";
    }
    //------>
    </SCRIPT>

    Problem now is that thumbs.php should have stuff added (as in thumbs.php?id=55&cat=20). Needless to say these values are PHP variables.
    It doesn't seem to be possible to include php code in a javascript function. Is there a way to fix this?
  2. #2
  3. Introspective
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Nov 2001
    Location
    London, UK
    Posts
    3,317
    Rep Power
    110
    there shouldn't be any probs getting php to generate the javascript... can you give some more explaination of what you want inserted into your URL's?

    you can just spit your javascript in just the same way as HTML with echo or printf and build the URL strings dynamically

    christo
    This is me: http://chris.uk.com
  4. #3
  5. No Profile Picture
    wizz@linux.be
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    belgium
    Posts
    30
    Rep Power
    13
    god, i need some sleep. it works like a charm. Sorry bout the post.

IMN logo majestic logo threadwatch logo seochat tools logo