Results 1 to 2 of 2

Thread: Positive I have a syntax error - onChange redirect to URL

  1. #1
    Hyperactive Member mateo107's Avatar
    Join Date
    Jan 05
    Posts
    427

    Positive I have a syntax error - onChange redirect to URL

    So,

    I've got a selection box on my form and when I use the follow onChange code, it works as expected
    Code:
    <select name = "LocSelect" onChange='location.href="editfilltable.asp?Location="+this.form.LocSelect.options[this.form.LocSelect.selectedIndex].value;'>
    The problem I have is that I also need to embed a static "un=" and then an ASP variable strUN to the URL.

    So, for example if the original code was straight html the URL would be:
    editfilltable.asp?Location=LOCATION1

    But I need it/want it to be:

    If strUN = testuser

    editfilltable.asp?un=testuser&Location=LOCATION1

    If strUN = anotheruser
    editfilltable.asp?un=anotheruser&Location=LOCATION2

    Does this make sense?

    I can't seem to get my code to work properly on my classic ASP page, by altering the original working code.


    -Matthew-

  2. #2
    PowerPoster
    Join Date
    Jun 01
    Location
    Trafalgar, IN
    Posts
    3,438

    Re: Positive I have a syntax error - onChange redirect to URL

    To embed a variable use this syntax <%= your variable %> so in your case it would be


    editfilltable.asp?un=<%=strUN%>&Location=LOCATION1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •