Results 1 to 3 of 3

Thread: using javascript to change css cursor

Hybrid View

  1. #1
    Join Date
    Jul 2010

    using javascript to change css cursor

    I am trying to alter some css using external javascript. I have 48 thumbnails on a page which bring up a pointer cursor onmouseover. The thumbnails have div ids of 'thumb_2_2' up to 'thumb_2_49' and a css class of 'thumb2'. I need to alter the cursor so that in certain situations the pointer doesn't show.
    This is the css :
    div.thumb2 {cursor:pointer;}
    I have tried altering the css class like this :

    and have also tried altering the individual divs like this :
    for(var i=2; i<=49;i++){
    and also like this :
    for(var i=2; i<=49; i++){
    but nothing seems to work.

    I would be really grateful if anyone could help. Thanks.

  2. #2
    Join Date
    Sep 2007
    This code is working in Firefox 4.0b9.

    As far as I know:
    <style type="text/css">
    div#pano1 { width: 100px; height: 161px; background-color: turquoise;  }
    div#pano2 { width: 100px; height: 161px; background-color: gold;  }
    .el { cursor : pointer; }
    .ok { cursor : default; }
    <script type="text/javascript">
    function changeClass() {
    var mydiv;
    for(var i=1; i<3; i++) {
    mydiv = document.getElementById('pano'+i);
    mydiv.className = "ok";
    <div id="pano1" class="el" > Fareyi buraya getir! </div>
    <div id="pano2" class="el" > Fareyi buraya da getirebilirsin. </div>
    <input type="button" value="click me to change class attribute of the div elements" onclick="changeClass()">
    Search Google
    Change HTML class attribute using javascript 
    Javascript Change Style Class of Div tag
    Last edited by Ayşe; 12-09-2011 at 09:39 AM.
    Hamd, Âlemlerin Rabbi, Rahmân, Rahîm, hesap ve ceza gününün (ahiret gününün) maliki Allah'a mahsustur. (Allahım!) Yalnız sana ibadet ederiz ve yalnız senden yardım dileriz. Bizi doğru yola, kendilerine nimet verdiklerinin yoluna ilet; gazaba uğrayanların ve sapıklarınkine değil.

  3. #3
    Join Date
    Jul 2010
    Apologies for late reply and many thanks, that seems to have fixed it. Much appreciated !!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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

Recent Articles