1

I've got my JS function

<html>
  <head>
    <script>
      function createYoutubeEmbedLink(link){
          return link.replace("http://www.youtube.com/watch?v=",
                                  "http://www.youtube.com/embed/");
        }
    </script>
  </head>

And I'm trying to get it to work with my query what I'm getting from the database

            while($songs = mysql_fetch_array($data))
        {
            Print "<b>Name (id): </b>" .$songs['id'] . "</br>";
            Print "<b>Url: </b>" .$songs['url'] . "</br>";
            Print "</br>";
        }
    ?>

This will display normal Youtube URLs but I'm trying to add the JS function to it so it would convert it to Youtube Embed video. Where should i put the JS function exactly?

4

1 に答える 1