How will the following JS to change the call mode, problem!



/* $ Access to the specified object
@Element object name
You can use the object name set, the return value set for the object
If you use the Prototype class library, please comment out the function
Sams_object.Get() Also the realization of all functions of the function
*/
function $(element)
{
if (arguments.length > 1)
{
for (var i = 0, elements = [], length = arguments.length; i <length; i++)
elements.push($(arguments[i]));
return elements;
}
if (typeof element == 'string')
element = document.getElementById(element);
return element;
}
/// The browser related operations
var Sams_browse =
{
/* Detection of the browse information */
checkBrowser : function ()
{
this.ver=navigator.appVersion
this.dom=document.getElementById?1:0
this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
this.ie4=(document.all && !this.dom)?1:0;
this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
this.mac=(this.ver.indexOf('Mac') > -1) ?1:0;
this.ope=(navigator.userAgent.indexOf('Opera')>-1);
this.ie=(this.ie6 || this.ie5 || this.ie4)
this.ns=(this.ns4 || this.ns5)
this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns5 || this.ns4 || this.mac || this.ope)
this.nbw=(!this.bw)
return this;
},
/* Set home
@URL should be set to the address of the home page
*/
SetDefault : function ()
{
this.style.behavior='url(#default#homepage)';
this.setHomePage(this.GetUrl());
return false;
},
/* Copy the specified URL address
@Msg to be written to the clipboard character set
*/
SetCopy : function (Msg)
{
if(navigator.userAgent.toLowerCase().indexOf('ie') > -1)
{
clipboardData.setData('Text',Msg);
alert (". "" +Msg+ "" \n has been copied to your clipboard in \n you can use the Ctrl+V shortcut key sticking to where it is needed.");
}
else
{
prompt("Please copy the web site address:",Msg);
}
},
/* Add to Favorites
@Site site name
@URL address
*/
AddBookmark : function (site, url)
{
if(navigator.userAgent.toLowerCase().indexOf('ie') > -1)
{
window.external.addFavorite(url,site)
}
else if (navigator.userAgent.toLowerCase().indexOf('opera') > -1)
{
alert ("Please use Ctrl+T to this page to your favorites");
}
else
{
alert ("Please use Ctrl+D to this page to your favorites");
}
}
};



$("element").Sams_browse.checkBrowser()

Started by Everley at December 08, 2016 - 7:32 AM

Change the call mode is what mean?
Write a facade or adaptation?

Posted by Hyman at December 10, 2016 - 7:58 AM

I mean to call to: $("element").Sams_browse.checkBrowser () form, how to modify the code

Posted by Everley at December 20, 2016 - 8:00 AM