I'm a newb when it comes to javascript. Perhaps somebody could help me with this. I assume it is not very complicated. This is what I would like:
<SCRIPT type=text/javascript>
var StandardURL = "http://site/Lists/test/AllItems.aspx";
</script>
<SCRIPT type=text/javascript>
var FilterURL = "http://site/Lists/test//AllItems.aspx?FilterField1=Judge&FilterValue1=";
</script>
var DynamicURL = FilterURL + DynamicUserInf (no space between it should be like one url link), dynamicuserinf contains different value depending on the user that is logged in no need to worry what is in it. It already contains a value befor this runs
var CurrentURL = current URL where this script is loading
<script language="JavaScript" type="text/javascript">
if (CurrentURL == StandardURL) { location.href= (DynamicURL);}
</script>
ElSE do nothing (i assume this is not neccarry with only one if statement)
Hopefully not much of a mess.
-
Am I right to assume that you need the code to get the current url and assign to CurrentURL or do you need something else to be done?anonymous– anonymous2010年04月09日 16:12:41 +00:00Commented Apr 9, 2010 at 16:12
-
unless i did it accidently good I would like to put in the var DynamicURL the variable FilterURL and DynamicUserInf in 1 var like for instance one is James other is Jenkins and it becomes JamesJenkins (notice no space). Als indeed the code to get the current url and assign to currentURL. If the rest of my code is correct that will be it for now.user300304– user3003042010年04月09日 16:17:17 +00:00Commented Apr 9, 2010 at 16:17
1 Answer 1
For getting current URL :
var CurrentURL = document.URL;
For joining/concatenating the variables (assuming that DynamicUserInf is a variable), you've already got it correct :)
var DynamicURL = FilterURL + DynamicUserInf;