| re: Really Odd OnClick issue
Laphan wrote:[color=blue]
> Hi All
>
> I'm using the same style of form on a number of pages, but for some reason
> the exact same one liner on one my pages doesn't do anything. The one liner
> is:
>
> <INPUT TYPE="BUTTON" onClick="location.href='admin.asp?sec=4&folder=32' "
> CLASS="FormButton" TABINDEX=41 VALUE='Go back to list'>
>
> Basically the user clicks this button and it takes the back to the main
> page, which is actually the same page, but the 'sec' determines what routine
> the page is going to run and display.
>
> The above works fine on my other pages, but not on one particular page so I
> must have something in this page that is stopping it from working, but I
> can't see what.
>
> If I put an alert before the location.href bit, eg
> onClick="alert('hello');location.href='admin.asp.. ., then the alert does
> appear when I click the button, which means it's my location ref that is
> fouling up.
>
> What is even weirder is that if I stick window. in front of the
> location.href command then it works, eg:
>
> <INPUT TYPE="BUTTON"
> onClick="window.location.href='admin.asp?sec=4&fol der=32'"
> CLASS="FormButton" TABINDEX=41 VALUE='Go back to list'>
>
> I know this solves my problem, but I'd like to know why this is the case.
>
> Any help you can give would be appreciated.[/color]
You may have a global variable named 'location', or you may have used
it for the name or id of an element somewhere. Try replacing the
onclick value with 'alert(location)' and see what happens, or search
for the string 'location' in the code.
--
Rob |