[thelist] help request: accessing url vars in javascript

Scott Harman scott at enteractiontv.com
Tue Mar 4 07:37:00 CST 2003


Good morning all,
I'm been fiddling with one of Jeff's examples
(http://members.evolt.org/jeff/code/js_url_variables/index.cfm) and am
having a problem accessing the variables in the right manner.

I'm trying to send a string (from php) containing a timestamp variable
named wplay_loc in this format, and then appending the referring url
called ref:
http://dev.server.com/netjuke/wplay.php?wplay_loc=wplay6784738?ref=http:
//dev.server.com/netjuke/

Now, the javascript seems to be working correctly to a point, but
instead of seperating out both named strings as variables - it returns
only a single variable named wplay_loc.

I've not modified Jeff's code in any way:
<script language=javascript>
  var qs = location.search.substring(1);
  var nv = qs.split('&');
  var url = new Object();
  for(i = 0; i < nv.length; i++)
  {
    eq = nv[i].indexOf('=');
    url[nv[i].substring(0,eq).toLowerCase()] =
unescape(nv[i].substring(eq + 1));
  }
</script>
And as far as I can tell, this is the correct syntax for my site.
The issue is that I need a popup, to carry the timestamp variable to an
embedded windows media player, and as such I'm using an interstital page
to convert my php variables to javascript, and return the user from the
referring page.

Can anyone shed any light on what I'm seeing here?
Can also post relevant code snippets so you can see where I'm coming
from.

All the best,

Scott



scott harman
head of engineering and IT






Latest News:
enteraction tv launches Thomas Cook Broadband site

enteraction tv - 8 park place - lawn lane - vauxhall - london SW8 1UD -
m: 0779 906 0009 t: 020 7820 4486 f: 020 7820 4471 www.enteractiontv.com


This e-mail and any files transmitted with it are confidential and
should not be read, copied, disclosed or used by any person other than
the intended recipient. Unauthorised use, disclosure or copying by
whatever medium is strictly prohibited and may be unlawful. If you have
received this e-mail in error please contact the sender immediately and
delete the e-mail from your system. Thank you for your co-operation.



More information about the thelist mailing list