0

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.

2
  • 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? Commented 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. Commented Apr 9, 2010 at 16:17

1 Answer 1

2

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;
Sign up to request clarification or add additional context in comments.

2 Comments

Thats funny i got the other one accidently correct. Going to test it. Thx for speedy reply
Hi Ierac, your code is correct. However you've a typo error where you declared the var DynamicUserInf as DynmaicUserInf. Try using alert(expression); to check if your code goes into the condition correctly or whether your variables store the correct values, that'll help a lot :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.