Microsoft Content Management Server - CMS and Javascript

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > October 2006 > CMS and Javascript





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author CMS and Javascript
Tom

2006-10-24, 7:18 am

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.
Stefan [MSFT]

2006-10-24, 1: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.



Tom

2006-10-24, 1:15 pm

OK but do you know the onunload event registered that would interact with my
code? And is there a javascript variable that needs to be set to prevent
this from happening?

Thanks

Tom


"Stefan [MSFT]" wrote:

> 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 [MSFT]

2006-10-24, 1:15 pm

Hi Tom,

there is no onunload event in the sample below.
So this is not related to the onunload event.

Cheers,
Stefan

--
This posting is provided "AS IS" with no warranties, and confers no rights


"Tom" <Tom@discussions.microsoft.com> wrote in message
news:B4BA4E8D-2F15-49FF-82B1-FC289AD92578@microsoft.com...[vbcol=seagreen]
> OK but do you know the onunload event registered that would interact with
> my
> code? And is there a javascript variable that needs to be set to prevent
> this from happening?
>
> Thanks
>
> Tom
>
>
> "Stefan [MSFT]" wrote:
>


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com