Javascript question

design

#1

Hi I have a small question about jscript: is it okay to have multiple scripts running at once; do they interfere with each other?

On my website I have four event count down timers (always running and resetting on every page) and I have multiple simplistic onClick javascript functions on specific pages. All of the onClick functions do not work if I include (using php) the clocks with the count down timers on the page. If I remove the clocks from the page the functions work. I have double checked variables and none seem to be similar. Does this simply have to do with my non-stop clocks?

Any help please? Am I missing something obvious? Thanks, much appreciated!
[hr]
it seems that the php variable “$open” screws up javascript


#2

PHP runs on the server, JS runs in the browser. You’d have to show the code to see how [font=courier]$open[/font] is having any effect.

One very easy way to keep your JS variables from clashing with other script’s variables in to enclose your script in an anonymous function:

(function () {
   // put your code here
}());

Run your code through jslint.com. It will hurt your feelings, then it will become your best friend.


#3

I am a learner javascript as a beginner want to know about the wide knowledge of development on initial stage. Here i want to ask a question from my senior community members. My question is that How can we implement an extend function that takes an object and extends it with new properties and makes it work on new levels of recursion? Basically, duplicating a jQuery extend. Anyone like to help me?


#4

Look into the prototype property.