plutomed Posted September 28, 2007 Share Posted September 28, 2007 Can anyone see a problem with this: function templates(num) { var url = window.location.href; var qparts = url.split("?"); var varname = "num_pgs"; var value = ""; if(qparts.length == 0) { return ""; } var vars = qparts.split("&"); for(i=0; i<vars.length; i++ { var parts = vars.split("="); if(parts[0] == varname) { value = parts[1]; break; } } if(num == value) { document.getElementById("templates").innerHTML = ""; } } Quote Link to comment https://forums.phpfreaks.com/topic/71085-solved-_get-in-javascript/ Share on other sites More sharing options...
RichardRotterdam Posted September 28, 2007 Share Posted September 28, 2007 if you just want to get the parameters in the url useing javascript there are plenty to find online here is one that works http://ilovethecode.com/Javascript/Javascript-Tutorials-How_To-Easy/Get_Query_String_Using_Javascript.shtml Quote Link to comment https://forums.phpfreaks.com/topic/71085-solved-_get-in-javascript/#findComment-357460 Share on other sites More sharing options...
plutomed Posted September 28, 2007 Author Share Posted September 28, 2007 Yea this is one I found, changed a bit and now it don't work. Can you see any problem with it? Quote Link to comment https://forums.phpfreaks.com/topic/71085-solved-_get-in-javascript/#findComment-357472 Share on other sites More sharing options...
RichardRotterdam Posted September 28, 2007 Share Posted September 28, 2007 just use the one that can be found at the link that one at least works and is a lot shorter Quote Link to comment https://forums.phpfreaks.com/topic/71085-solved-_get-in-javascript/#findComment-357487 Share on other sites More sharing options...
plutomed Posted September 28, 2007 Author Share Posted September 28, 2007 It's about the same I just spread mine out more. Plus that bit at the end of the code, the last if is something I added. Quote Link to comment https://forums.phpfreaks.com/topic/71085-solved-_get-in-javascript/#findComment-357529 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.