I am in the process of debugging my web application and hit a wall. I only experience behavior in Google Chrome, and my inappropriate javascript does not allow me to solve the problem.
I have an ASP page with a <asp:Panel> control. Inside the panel, I set the plain text search text and use <asp:LinkButton> to start the search. The user enters his search text and should be able to press Enter (for ease of use ), and the search results will be displayed. This works in IE, but not in FireFox. There is a documentary fix that I applied to my page and successfully received the FireFox function. Golden
In addition, the fix does not work in Google Chrome! A little suspicious, I'm running Firebug to debug the code ... oh wait ... this is just a Chrome issue. Ok, fine, I can handle javascript debugging without Firebug (sob) - I run the Chrome debugger and go through the code. Turns out the javascript fix mentioned earlier is discarded by Chrome.
The script fix is executed when the page loads and changes the LinkButton click LinkButton :
var defaultButton = document.getElementById('<%= lnkSearch.ClientID %>'); if (defaultButton && typeof(defaultButton.click) == 'undefined') { defaultButton.click = function() { alert('function fired'); var result = true; if (defaultButton.click) result = defaultButton.onclick(); if (typeof(result) == 'undefined' || result) { eval(defaultButton.getAttribute('href')); } }; alert(typeof(defaultButton.click) != 'undefined'); }
And when I start the page in the chrome debugger, I go to the function WebForm_FireDefaultButton() and go to the line:
if (defaultButton && typeof(defaultButton.click) != "undefined") { ... }
and for some reason defaultButton.click became "undefined" . I'm at a dead end ... What am I missing?
Also, I am not using jQuery, and this is not a viable solution.
Created HTML:
<div id="abc_pnlSearchPanel" language="javascript" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'abc_lnkSearch')"> <div class="searchPanel"> <span class="searchText"> Type in stuff to search: </span> <span style="float: left;"> <input name="abc:txtSearch" type="text" id="abc_txtSearch" style="width:312px;" /> </span> <a onclick="this.blur();" id="abc_lnkSearch" class="ButtonLayout" href="javascript:__doPostBack('abc$lnkSearch','')"><span>Search</span></a> <div style="clear: both"></div> </div> </div>
javascript debugging google-chrome javascript-events
Gavin miller
source share