-1

First, I'm not a javascript developer so I don't have a great deal of experience in this if any.

I have a footer I'm inserting into an HTML page using jQuery that has the following code in it that per the client "NEEDS TO BE THERE".

<script language="JavaScript"><!--
/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
var s_code=s.t();if(s_code)document.write(s_code)//--></script>
<script language="JavaScript"><!--
if(navigator.appVersion.indexOf('MSIE')>=0)document.write(unescape('%3C')+'\!-'+'-')
//--></script>

I don;t really have to worry about anything except this s.t(); line of code. I need to write a dummy Object or whatever else and include it in the header that doesn't do anything per se except prevent a javascript error from occurring.

So really I need "s" the object to be instantiated and have a function "t" attached to it that basically does nothing.

Any help is appreciated. This isn't something I want to do but given the budget and project constraints of the client I just need for this to work without a javascritp error.

thanks if you can help.

2
  • That is Omniture's code. omniture.com/en Commented Oct 27, 2009 at 10:34
  • This piece of code is the basic code for Omniture SiteCatalyst. You must include the s_code.js. Otherwise, the code you showed is useless. Commented Aug 26, 2011 at 10:53

2 Answers 2

1

Using javascript prototype:

function s () {
}

function doSomething () {
}

s.prototype.t = doSomething;

edit: typo

Sign up to request clarification or add additional context in comments.

2 Comments

This isn't complete, you cannot write s.t(); - s isn't a variable. it should be var s2=new s(); s2.t();, so you may want to change s's name.
Yeah, was only thinking about providing the object that he has to use.
0
var s = {
   t: function(){}
};

See it in, hmm, action: http://jsbin.com/oboju

In case you're worried s is defined and don't want to override it, you can check for it first (this doesn't cover the case s.t is defined but isn't a function):

if(!s){ // check if s exists
  var s = [];
}
if(!s.t){ // check if s has t
  s.t = function(){};
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.