FREE tutorial,solution,RSS Feeds on Operating Systems, Programming, Web Development, Applications, Databases, Networking, Hardware, Security, SEO Free Expertsforge Membership
Join us as Moderator
Submit Article to Expertsforge.com Submit Article My Expertsforge
 
RSS Feeds, Help Help RSS Feeds
bannertop
 

JavaScript Tutorial: Disabling Click to activate and use this control using Javascript

jawahar
1/3/2007 5:31:53 PM, Views: 1978
Click to activate and use this control is the common tooltip message given by Internet Explorer browser version 6 and above (IE 6 and above). The following code is the solution to this problem.

Method 1:
Disabling click for required objects like "OBJECT", "EMBED", "APPLET" etc.,)
<html>
<head>
<title>Solution for Click to activate and use this control Method 1</title>
</head>
<body>

<!--[if gte IE 6]><script language="javascript">document.write("<NOSCRIPT class=clickfix><OBJECT style=\"display:none\">"); </script> <![endif]-->
<object ...>
   <param ...>
   <embed ...></embed>   
</object>
<!--[if gte IE 6]></OBJECT></NOSCRIPT><![endif]-->


<!--[if gte IE 6]><script language="javascript">document.write("<NOSCRIPT class=clickfix><OBJECT style=\"display:none\">"); </script> <![endif]-->
<object ...>
   <param ...>
   <embed ...></embed>   
</object>
<!--[if gte IE 6]></OBJECT></NOSCRIPT><![endif]-->

<script language="JScript" type="text/jscript" src="/ctrlclickfix.js"></script>
</body>
</html>


Content of ctrlclickfix.js
window.onload = function() {
   elems=document.getElementsByTagName("noscript");
   for(i=elems.length-1;elem=elems[i];i--) {
      if(elem.className=="clickfix")
         elem.outerHTML = elem.innerHTML;
}}



Method 2:
Include once method
<html>
<head>
<title>Solution for Click to activate and use this control Method 2</title>
</head>
<body>

<!--[if gte IE 6]><script language="javascript">document.write("<NOSCRIPT class=clickfix><OBJECT style=\"display:none\">"); </script> <![endif]-->
<object ...>
   <param ...>
   <embed ...></embed>   
</object>
<!--[if gte IE 6]></OBJECT></NOSCRIPT><![endif]-->


<!--[if gte IE 6]><script language="javascript">document.write("<NOSCRIPT class=clickfix><OBJECT style=\"display:none\">"); </script> <![endif]-->
<object ...>
   <param ...>
   <embed ...></embed>   
</object>
<!--[if gte IE 6]></OBJECT></NOSCRIPT><![endif]-->

<script language="JScript" type="text/jscript" src="/DeActivateCtrl.js"></script>
</body>
</html>


Content of DeActivateCtrl.js
n=navigator.userAgent;
w=n.indexOf("MSIE");
if((w>0)&&(parseInt(n.charAt(w+5))>5)){
T=["object","embed","applet"];
for(j=0;j<3;j++){
E=document.getElementsByTagName(T[j]);
for(i=0;i<E.length;i++){
P=E[i].parentNode;
H=P.innerHTML;
P.removeChild(E[i]);
P.innerHTML=H;
}}}
Next Steps:
Add this Tutorial to:
Blink Blink del.icio.ous Del.icio.us Digg Digg
Fark Fark Furl Furl Google Google
Reddit Reddit Simpy Simpy Spurl Spurl
Technorati Technorati Windows Live Win Live Yahoo Yahoo
Rate Me!
Avg Visitor Rating: Average Visitor Rating is 4.5 out of 5
Number of Ratings : 2 Votes
Rate:
Send Private MessageSend Message
Signup / Login To View the Solution or Provide Comments
Post Comment/Solution
Comment:*
        (Link Rules) 
  Use : [bold] for <b>; [/bold] for </b>; [italic] for <i>; [/italic] for </i>; [code] & [/code] for code
 
Categories
Options
JavaScript RSS Feed
Most Popular Tutorial
Most Popular Solution
Top Rated
Top Contributors
Yearly
Overall
 
1. jawahar (300)
bnrtop