#1
  1. webber
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2000
    Location
    San Juan - Argentina
    Posts
    594
    Rep Power
    14
    Hi guys. It's time to ask about JavaScript & PHP.
    I've tried to do this but this not worked:
    I've an image which it's url_link is generated with php, like this:
    <a href="vote.php3?pic=<?php echo $x; ?>&votes=<?php echo $v; ?>"><img border="0" src="blablabla" ...></a>
    Well the thing i wanna do is to make the image look like this:
    <a href="JavaScriptpeninnewwindow()"><img border="0" src="blablabla" ...></a>
    And then make a JavaScript function in the website which would look like this:
    function openinnewwindow()
    {
    window.open('vote.php3?pic=<?php echo $x; ?>&votes=<?php echo $v; ?>','Name of window','blabla')
    }
    It doesn't work cause it makes conflict with javascript sintax...
    What da ya recomend me to do, so the image link opens in new window? And ovbiously, to mantain the
    dynamic generation of the image link.
    Hope you've understood the idea. Thanks in advace.
    Henry - Argentina.

    ------------------

    Henry - Argentina
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2000
    Posts
    669
    Rep Power
    14
    try passing the variabvles in the the function call like so:
    <?
    $url = "vote.php3?pic=".$x."&votes=".$v;
    ?>
    <a href="JavaScript peninnewwindow('<? print $url; ?>')"><img border="0" src="blablabla" ...></a>
    Then the javascript:
    function openinnewwindow(url)
    {
    window.open('' + url + '','Name of window','blabla')
    }


Similar Threads

  1. PHP scripts to run in Javascript continuously
    By linhardt in forum JavaScript Development
    Replies: 0
    Last Post: February 13th, 2004, 02:51 PM
  2. javascript inside php tags
    By andy123 in forum JavaScript Development
    Replies: 5
    Last Post: February 5th, 2004, 04:34 PM
  3. Javascript in PHP
    By tintintin in forum JavaScript Development
    Replies: 5
    Last Post: January 28th, 2004, 05:40 AM
  4. php, mysql, and a tiny bit of javascript programmer for hire
    By benthekiller in forum JavaScript Development
    Replies: 0
    Last Post: January 21st, 2004, 01:15 PM
  5. Passing string from PHP to Javascript
    By ka8oad in forum JavaScript Development
    Replies: 4
    Last Post: January 17th, 2004, 03:12 PM

IMN logo majestic logo threadwatch logo seochat tools logo