0

i try to develop a page but does not work on IE.

This is the actual page:

http://portal.sinemalar.com/tv/vestel/v1/artist/48029/1/1/1/2/

You can use up and down arrow keys.It works on Google Chrome and Firefox but does not work on IE

This is the code :

<script type="text/javascript">
    {literal}
    document.onload = function () {
        MousePlayClick();
    }
    {/literal}
</script>

<script type="text/javascript">
    {literal}
    function artistKeyPress(evt) {
        switch (evt.keyCode) {
            case KEYS.UP:
                if ($page > 1) {
                    $page--;
                    window.location.href = baseUrl + 'artist/' + $movieId + '/' + $vPage + '/' + $yPage + '/' + $slot + '/' + $page + '/';
                }
                break;
            case KEYS.DOWN:
                $page++;
                window.location.href = baseUrl + 'artist/' + $movieId + '/' + $vPage + '/' + $yPage + '/' + $slot + '/' + $page + '/';
                break;
            case KEYS.RED:
                window.location.href = baseUrl + 'detail/' + $movieId + '/' + $vPage + '/' + $yPage + '/' + $slot + '/';
                break;
        }
    }
    {/literal}
</script>

<script>    

    var $slot = {$cursor};
    var $vPage = {$vPage};
    var $yPage = {$yPage};
    var $page = {$page};
    var $movieId = {$movieId};
    var $mp4Link = '{$mp4Link}';
    {literal}        
    document.onkeydown = function(evt) 
    {
        artistKeyPress(evt);
    }
    {/literal}
</script>
<div class="main_content">
    <a href="{$portalPath}vestel/v1/artist/{$movieId}/{$prevPage}"><div class="yorum_yukari_ok ortala"></div></a>
    {foreach value=artist key=key from=$artists}
    <div class="yatay_kutu{if $key%2==0}_secili{/if}">
        <div class="yk_foto_cont_s">
            <img src="{$artist.picture}" height="132px" />
        </div>
        <div class="yorum_a">
            <h2 class="bold">{$artist.nameSurname}<span class="sag">Puan:{$artist.rating}/10</span></h2>
            {$artist.bio}
        </div>
    </div>
    {/foreach}
    <a href="{$portalPath}vestel/v1/artist/{$movieId}/{$nextPage}"><div class="yorum_asagi_ok ortala"></div></a>
</div>

What might be the reason ?

6
  • 1
    javascript and ie hate each other. Commented Mar 15, 2012 at 16:14
  • @Mert, the page you posted has errors on page load (in chrome). I suggest fixing those error before going any further. Commented Mar 15, 2012 at 16:16
  • The up and down arrow keys does not work on ie but works on chrome and firefox. @James i dont take any error :S Commented Mar 15, 2012 at 16:18
  • it 'works' in ie9. Maybe post your error. It might help you getting help Commented Mar 15, 2012 at 16:19
  • @MertMETİN, look at the console - This line is a problem: document.getElementById('player_div').setAttribute('onclick', 'MousePlayClick()');. This is not your issue, but start here. Commented Mar 15, 2012 at 16:19

2 Answers 2

2

Internet explorer doesn't understand evt.keyCode, instead try:

var keyCode = (window.event) ? window.event.which : evt.keyCode;

switch(keyCode){
   //...
}
Sign up to request clarification or add additional context in comments.

Comments

1
function artistKeyPress(evt) {
    evt = evt || window.event;  //handles IE which uses window.event for the details
    var keyCode = evt.keyCode || evt.which;  //handles cross browser with what key was pressed
    switch (keyCode) {

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.