By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,481 Members | 1,713 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,481 IT Pros & Developers. It's quick & easy.

code run in IE how it ll for ff(Calender Usercontrol )

P: 2
Hi all,

i have created a Calender user control which can run only IE.but i want the code for mozila,,,,

the code i placed here....



Expand|Select|Wrap|Line Numbers
  1. /* hides <select> and <applet> objects (for IE only) */
  2. function hideElement( elmID, overDiv )
  3.  
  4. {
  5. if( ie )
  6.  
  7. {
  8. for( i = 0; i < document.all.tags( elmID ).length; i++ )
  9.  
  10. {
  11.  
  12. obj = document.all.tags( elmID )[i];
  13. if( !obj || !obj.offsetParent )
  14.  
  15. {
  16. continue;
  17.  
  18. }
  19.  
  20.  
  21.  
  22. // Find the element's offsetTop and offsetLeft relative to the BODY tag.
  23.  
  24. objLeft = obj.offsetLeft;
  25.  
  26. objTop = obj.offsetTop;
  27.  
  28. objParent = obj.offsetParent;
  29.  
  30.  
  31. while( objParent.tagName.toUpperCase() != "BODY" )
  32.  
  33. {
  34.  
  35. objLeft += objParent.offsetLeft;
  36.  
  37. objTop += objParent.offsetTop;
  38.  
  39. objParent = objParent.offsetParent;
  40.  
  41. }
  42.  
  43.  
  44.  
  45. objHeight = obj.offsetHeight;
  46.  
  47. objWidth = obj.offsetWidth;
  48. if(( overDiv.offsetLeft + overDiv.offsetWidth ) <= objLeft );
  49.  
  50. else if(( overDiv.offsetTop + overDiv.offsetHeight ) <= objTop );
  51. else if( overDiv.offsetTop >= ( objTop + objHeight ));
  52.  
  53. else if( overDiv.offsetLeft >= ( objLeft + objWidth ));
  54.  
  55. else
  56.  
  57. {
  58. obj.style.visibility = "hidden";
  59.  
  60. }
  61.  
  62. }
  63.  
  64. }
  65.  
  66.  
  67. /*
  68.  
  69. * unhides <select> and <applet> objects (for IE only)
  70.  
  71. */
  72. function showElement( elmID )
  73.  
  74. {
  75. if( ie )
  76.  
  77. {
  78. for( i = 0; i < document.all.tags( elmID ).length; i++ )
  79.  
  80. {
  81.  
  82. obj = document.all.tags( elmID )[i];
  83.  
  84.  
  85. if( !obj || !obj.offsetParent )
  86.  
  87. {
  88. continue;
  89.  
  90. }
  91.  
  92.  
  93. obj.style.visibility = "";
  94.  
  95. }
  96.  
  97. }
Help me.....



sunaya..
Jul 28 '08 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
Use document.getElementById() instead of document.all.

Also, test in a more standards-compliant browser first before finally testing in IE. This will make your code more likely to be cross-browser.
Jul 29 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.