10-24-06 06:15 PM
Hi Tom,
it does not seem to be a MCMS problem.
Cut and paste the code below into a test.html file and you will see the same
behaviour:
-----------
<form>
<input type="text" onkeypress=GoToSearch(event) />
<script>
function GoToSearch(e)
{
if(e.keyCode == 13)
{
document.location.href = "http://www.yahoo.com";
}
}
</script>
<a
href="java script:document.location.href='http://www.yahoo.com'">test2</a>
</form>
-----------
Using the test2 link it works. But using the enter key in the onkeypress
handler does not work.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
"Tom" <Tom@discussions.microsoft.com> wrote in message
news:4DFAD9F9-FC15-4789-B71D-4A3A23E584B4@microsoft.com...
> Stefan:
>
> Just following up ona thread from last week that I think got lost in the
> shuffle.
>
> On my MCMS template page with 'Switch To Edit' showing I have an input
> button
> with this code.
>
> <input type="text" onkeypress=GoToSearch(event) class="search" />
>
> Now in my incldued javascript code I have this but the browser only blinks
> back at me and does not redirect me.
>
> function GoToSearch (e)
> {
> if (e.keyCode == 13)
> {
> window.location.href = "http://www.yahoo.com";
> }
> }
>
>
> Thisis what you wrote. Can you tell me where the onunload event
> registered
> you are referring to and javascript variable that needs to be set to
> prevent
> this from happening.
>
> Thanks Tom
>
>
>
> Hi Tom,
>
> if I remember right (I don't have access to a CMS system at the moment)
> there is an onunload event registered that would interact with your code.
> And there should be a javascript variable that needs to be set to prevent
> this from happening.
> You might want to search the html/javascript code of MCMS for this to
> implement a workaround.
[ Post a follow-up to this message ]
|