The followingCodeIt works normally in IE but not in Firefox/chrome. Why?
C #:
This. textboxemailaccount. Attributes. Add ("defaultvalue", this. useraccounttextboxdefaultvalue );
JS:
Function focususeraccountbox (OBJ ){
If (obj. value = obj. defaultvalue ){
OBJ. value = "";
}
OBJ. style. color = "black ";
}
Function bluruseraccountbox (OBJ ){
If (obj. value = ""){
OBJ. value = obj. defaultvalue;
OBJ. style. color = "gray ";
}
}
The method for retrieving sessions in JS is not supported in Firefox/chrome!
<SCRIPT type = "text/JavaScript">
If (document. getelementbyid ("mainiframe ")! = NULL)
{
VaR url = '<% = session ["currentpageurl"] %> ';
Alert (URL)
VaR menulevel = '<% = session ["currentpagemenulevel"] %> ';
If (URL! = "" & URL! = NULL)
{
Document. getelementbyid ("mainiframe"). src = '<% = session ["currentpageurl"] %> ';
}
If (menulevel! = "" & Menulevel! = NULL ){
Setnavigator (menulevel. Replace ("$ ","&"));
}
}
</SCRIPT>
The following JavaScript code cannot be written in Firefox/chrome!
Function document. onkeydown (){
If (window. event. keycode = 13 & window. Event ){
Document. getelementbyid ("qbuttonlogin"). Click ();
}
}
Alternative solution:
<SCRIPT type = "text/JavaScript">
<! --
If (document. addeventlistener) {// if it is Firefox
Document. addeventlistener ("keypress", firefoxhandler, true );
} Else {
Document. attachevent ("onkeypress", iehandler );
}
Function firefoxhandler (EVT ){
// Alert ("Firefox ");
If (EVT. keycode = 13 ){
Validatelogon ();
}
}
Function iehandler (EVT ){
// Alert ("ie ");
If (EVT. keycode = 13 ){
Validatelogon ();
}
}
// -->
</SCRIPT>