开发者

How do I override a javascript function that is inside another file?

I am having a problem with the asp:Menu control.

A menu control 2 levels deep 开发者_开发百科does not play well with internet explorer on https.

I continually get an annoying popup.

I think in order to fix this I need to override a function in an automatically included script file.

change this

function PopOut_Show(panelId, hideScrollers, data) {
...
childFrame.src = (data.iframeUrl ? data.iframeUrl : "about:blank");
...
}

to this

function PopOut_Show(panelId, hideScrollers, data) {
...
if(data.iframeUrl)
childFrame.src = data.iframeUrl;
...
}

however I have no clue how I would hack apart the asp:menu control to fix microsoft's javascript in their control.

Is there a way I can just override the function to what I need it to be?


If you declare the overload later that should be the function that executes

function alerttest(){
alert("1");
}

function alerttest(){
alert("2");
}

alerttest();

Here is another answer: Overriding a JavaScript function while referencing the original


childFrame.src = (data.iframeUrl ? data.iframeUrl : "about:blank");

Is identical to:

if(data.iframeUrl){
    childFrame.src = data.iframeUrl;
}
else{
    childFrame.src = 'about:blank';
}

Why do you need to override the function?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜