A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Please HELP!! Javascript loop problem

  1. #1
    Junior Member
    Join Date
    Oct 2010

    Please HELP!! Javascript loop problem

    So I have been struggling with a Javascript issues for a couple of days now and can't find an answer anywhere online that has helped.

    I have a javascript loop that is looping through all of my <dfn> html tags. These tags are used to not a glossary term on my page. When the user mouses over the term it shows a popup with the term name and the definition. Here is my javascript function:

    Actionscript Code:
    function definitionRollover(){
        var j;
        var dfns = document.getElementsByTagName('dfn')
        for (j=0; j<dfns.length;j++){
            var term = dfns[j].innerHTML.charAt(0).toUpperCase() + dfns[j].innerHTML.slice(1);
            var definitionArray = new Array(term, dfns[j].title);
            var def = dfns[j].title;
            dfns[j].onmouseover = function(){stm(definitionArray,Style[0])}
            dfns[j].onmouseout = function(){htm();};

    As you can see I am adding a onmouseover event to these <dfn> tags which calls another function with the definition and term being held in the definitionArray. This works great until I have multiple terms on a page. When I have multiple terms it only shows the last terms definition for all terms. My question is how I can get it to work for all terms. I know that throughout the loop the definitionArray is holding the correct info at the correct time but for some reason it only shows the last one.

    I hope that this makes sense and if anyone could give me any tips or leads it would be very much appreciated.


  2. #2
    Junior Member
    Join Date
    Dec 2011
    i will try your script and let you know the details in few minutes.
    your post is very old if you are still in search of script problems i can help.
    please let me know your response regardingly

Posting Permissions

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

Click Here to Expand Forum to Full Width

HTML5 Development Center