Pass variable to javascript use javascript

Client wants add following tracking code on website:

<script type="text/javascript" src="[CACHEBUSTER]&mpvc=">
  <a href="[CACHEBUSTER]">
    <img src="[CACHEBUSTER]" alt="Click Here" border="0">

To ensure accurate tracking, they want [CACHEBUSTER] can be replaced by a Time Stamp when page reload.

This is the way we use:

<script type="text/javascript">
var currentTime = new Date(); 
var time_stamp = currentTime.getTime(); 

document.write('<scr' + 'ipt type="text/javascript" src="' + time_stamp + '"></scr' + 'ipt>');
document.write("<noscr' + 'ipt>");
document.write('<a href="' + time_stamp + '">');
document.write('<img src="' + time_stamp + '" alt="Click Here" border="0"></a>');
document.write('</noscr' + 'ipt>');
Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

No Responses to “Pass variable to javascript use javascript”

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>