SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question pass dynamic variables into src of script tag?

    Here is the code in question...

    Code:
    <script language="javascript">
    var URL = document.location.href;
    var Title = document.title;
    </script>
    <script language="javascript" src="http://www.bloggingtories.ca/memberActivity.php?URL="+URL+"&Title="+Title></script>
    It does call memberActivity.php but the URL and Title querystring values are blank. The page does a SQL INSERT into a database. Is there a better way to go about this? I want people to be able to place this script in their web site.

    Thanks.

  2. #2
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <script type="text/javascript">
    var 
    URL document.location.href;
    var 
    Title document.title;

    document.write('<script type="text/javascript" src="http://www.bloggingtories.ca/memberActivity.php?URL=' URL  '&Title=' 'Title><' '/script>');
    </script> 
    I'm available for hire! - www.deftdevelopment.com


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
  •