开发者

jQuery - expected identity or string

开发者 https://www.devze.com 2022-12-17 10:12 出处:网络
I fårexpected identity or string o开发者_开发问答n the \"if (vContains (gMouseoverBox) == true) (\" to

I fårexpected identity or string o开发者_开发问答n the "if (vContains (gMouseoverBox) == true) (" to What is the reason for this?

var pProjectID = "static";
var gMouseoverBox = pProjectID + "_IF";
var arrBoxesNotMouseOvered = [];


function vContains(pName) {
    for (var i = 0; i < arrBoxesNotMouseOvered.length; i++) {
        if (arrBoxesNotMouseOvered[i] == pName) {
            arrBoxesNotMouseOvered[i] = null;

            return true;
        }
    }
    return false;
}



function PopulateTooltipSuccess(pResponse) {

    $('#' + gMouseoverBox).tooltip({

        if( vContains(gMouseoverBox) == true ) { 
            var elem = document.getElementById(gMouseoverBox); 
            var coord = { clientX: getElementLeft(gMouseoverBox)+1, clientY: getElementTop(gMouseoverBox)+1 };  //coordinates doesn't work perfecly in IE but does in Firefox

            $('#' + gMouseoverBox).simulate("mouseover", coord);
            $(this).oneTime(2000, function() {
                $('#' + gMouseoverBox).simulate("mouseout", coord);
                }); 
        }
    })
}


I'm not entirely sure what you are asking. Maybe you could edit your question to be a bit clearer?

From your code, I can see the following:

  1. Can you post the accompanying html? Do you have an element with id "static_IF" ?
  2. Your arrBoxesNotMouseOvered is not populated. I'm guessing this happens elsewhere? Maybe we could see this code.
  3. You never use the variable elem (and your doing a document.getElementById() instead of a jQuery selection
  4. You do $('#' + gMouseoverBox) and $(this). These should be the same.
  5. $gMouseoverBox.tooltip({ - Do you mean to seocify an anonymous function here? See code below:

Suggest the following code instead:

function PopulateTooltipSuccess(pResponse) { 

    var $gMouseoverBox = $('#' + gMouseoverBox);
    $gMouseoverBox.tooltip(function(){ 
        if( vContains(gMouseoverBox) == true ) {  
            var coord = { 
                clientX: getElementLeft(gMouseoverBox)+1, 
                clientY: getElementTop(gMouseoverBox)+1 
            };  //coordinates doesn't work perfecly in IE but does in Firefox 

            $gMouseoverBox.simulate("mouseover", coord); 
            $gMouseoverBox.oneTime(2000, function() { 
                $gMouseoverBox.simulate("mouseout", coord); 
            });  
        } 
    });
} 

Without understanding exactly what you're trying the achieve that's all I can say at the moment.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号