• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 970
  • Last Modified:

Javascript Link Concatenation

How can I modify my link to use the user value from the following JS:

<script type="text/javascript" language="javascript">
    user=top.getArray('userInfo', 'user')
</script>

<input class="btn" onclick="top.showPopWin('../_Pages/Utilities.aspx?user=' +user', 600, 430, null, true,'Utilities'); return false;"   onmouseout="hov(this,'btn')" onmouseover="hov(this,'btnhov')" type="button" value="Click Me" />
0
yourbudweiser
Asked:
yourbudweiser
  • 2
1 Solution
 
Frosty555Commented:
Assuming your top.getArray() function and your showPopWin() function is working, It looks okay to me, though I do see a syntax error:
   top.showPopWin('../_Pages/Utilities.aspx?user=' +user', 600, 430...
that ' shouldn't be there, e.g.:
   top.showPopWin('../_Pages/Utilities.aspx?user=' +user, 600, 430,
----------

This example worked for me:

<script>
      user = 'test'
</script>

<form>
<input value="click me" type="button" onclick="alert('user was ' + user);">
</form>

Clicking the button makes an alert show that says "user was test"
0
 
yourbudweiserAuthor Commented:
i should have mentioned that I am using this in an asp.net page but regardless I solved this on my own, was similar to yours:

    <script type="text/javascript" language="javascript">
        var user=top.getArray('userInfo', 'user')
        destURL=("../_Pages/Utilities.aspx?user=" +user)
    </script>

onclick="top.showPopWin(destURL, 600, 430,
0
 
yourbudweiserAuthor Commented:
i should have mentioned that I am using this in an asp.net page but regardless I solved this on my own, was similar to yours:

    <script type="text/javascript" language="javascript">
        var user=top.getArray('userInfo', 'user')
        destURL=("../_Pages/Utilities.aspx?user=" +user)
    </script>

onclick="top.showPopWin(destURL, 600, 430,
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now