Hi all. Here's the lowdown on our problem. We have an HTC behavior which has been working for a long time at all of our clients. We recently acquired a new client and for some reason the behavior doesn't work - and is causing all other javascript on the page to break (with no error messages). Our browser versions are identical, down to the last 4 version numbers, MS service patches etc. and we can't reproduce in our office.
I've stripped out all of the code and left in some very basic debugging code. The mystery has grown even deeper now. I have 2 links on the page which are using this behavior. In the HTC, I've stripped out everything except a function which displays an alert dialog onfocus of either link. Both work fine. If I add back in a function (which isn't even getting called), the first focus works, but the second now breaks. Even if I comment out the code in this new function, the second link still breaks. However, if I delete the commented out code, both alerts now work.
This seems to be behaving very strangely and inconsisently. How can commented out code affect the execution? I've posted the debug HTC file below. Any ideas would be much appreciated!
The code below will only give an alert on the first href at my client. On our machine both hrefs give the alert. If I comment out the code inside of the function named "blah()" it will still break at the client. If I REMOVE the code, keeping the function, it will now work for our client.
<PUBLIC:COMPONENT>
<PUBLIC:ATTACH EVENT="onfocus" ONEVENT="myfocus()" />
<SCRIPT LANGUAGE="JavaScript">
// Select.htc -- Add Incremental Search to a <SELECT>
function myfocus()
{
alert('myfocus')
}
function KeyDown()
{
if (event.keyCode != 9)
inControl = false;
return true;
}
function blah()
{
var i, delta, lasttime;
lasttime = time;
time = new Date();
inControl = true;
if (!lasttime) {
lasttime = time;
}
delta = "test";
}
</SCRIPT>
</PUBLIC:COMPONENT>
On the HTML page itself, I have:
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#" class="alphaSelect" style="background: yellow" id="box">box # 1</a>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#" class="alphaSelect" style="background: yellow" id="boxy">box # 2</a>
I've stripped out all of the code and left in some very basic debugging code. The mystery has grown even deeper now. I have 2 links on the page which are using this behavior. In the HTC, I've stripped out everything except a function which displays an alert dialog onfocus of either link. Both work fine. If I add back in a function (which isn't even getting called), the first focus works, but the second now breaks. Even if I comment out the code in this new function, the second link still breaks. However, if I delete the commented out code, both alerts now work.
This seems to be behaving very strangely and inconsisently. How can commented out code affect the execution? I've posted the debug HTC file below. Any ideas would be much appreciated!
The code below will only give an alert on the first href at my client. On our machine both hrefs give the alert. If I comment out the code inside of the function named "blah()" it will still break at the client. If I REMOVE the code, keeping the function, it will now work for our client.
<PUBLIC:COMPONENT>
<PUBLIC:ATTACH EVENT="onfocus" ONEVENT="myfocus()" />
<SCRIPT LANGUAGE="JavaScript">
// Select.htc -- Add Incremental Search to a <SELECT>
function myfocus()
{
alert('myfocus')
}
function KeyDown()
{
if (event.keyCode != 9)
inControl = false;
return true;
}
function blah()
{
var i, delta, lasttime;
lasttime = time;
time = new Date();
inControl = true;
if (!lasttime) {
lasttime = time;
}
delta = "test";
}
</SCRIPT>
</PUBLIC:COMPONENT>
On the HTML page itself, I have:
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#" class="alphaSelect" style="background: yellow" id="box">box # 1</a>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#" class="alphaSelect" style="background: yellow" id="boxy">box # 2</a>