Jump to content

Scripts conflict with each other.


acctman

Recommended Posts

The two scripts below are have a conflict with each other. Script 1 is generating an error in script 2. If i remove script 1 everything works fine in script2. Script 2 is more important that script1 which just display a headline every fee seconds. is there anything i can do to fix script 1 and stop it for throwing an error

 

This script which is not related to another scriipt is causing an error.

Script 1

 

<input  id="foo" size="60" type="text">

<script type="text/javascript">

$ = function(e) {return document.getElementById(e);};

var display = function(el) {

  var msg = [

  "Test1.",

  "Test2.",

  "No Advertising of other Sites."],

    e = $(el), c = "count",

    timer = 6500;

  if (typeof e[c] == "undefined") {

    e[c] = -1;

  };

  if (e[c] > msg.length-2) {

    e[c] = 0;

  } else {

    ++e[c];

  };

  e["value"] = msg[e[c]];

  var t = setTimeout(function() {display(el);}, timer);

};

display("foo");

</script>

 

 

 

'null' is null not an object Line2 Char2

Script 2

 

$(document).ready(function() {

$("#open").click(function(){

$("div#panel").slideDown("slow");

return false;

});

// Collapse Panel

$("#close").click(function(){

$("div#panel").slideUp("slow");

return false;

});

$("#toggle a").click(function () {

$("#toggle a").toggle();

});

});

 

Link to comment
Share on other sites

looks like you're using jQuery. If that is the case you don't need the function $(); Just remove the script 1. and use the $() function inside jQuery

 

$ = function(e) {return document.getElementById(e);};

should be

$(e) {return document.getElementById(e);};

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.