Forum:Running JavaScript functions

I added the folloing code to a page:

text...

But after I saved the page and viewed it's source code, it looks like this:

text...

Here is an example:

text...

Is that on purpose? Would it be possible to request to allow JavaScript on my wiki?

What I'm trying to do it to have a message apear when the mouse cursor hovers over a word (the JavaScript function I will place in Monobook.js).

Thanks in advance, Ori229 07:20, 3 May 2007 (UTC)


 * MW probably strips that out for safety reasons. What you half to do is use an addOnloadHook; and add a function which will add the stuff to there. Mostly this is done with classes, some arbartrary css class is used to define what a script should do. Take a look at the ShowHide code for an example on how to do that. ~Dantman(talk) tricks May 3, 2007 @ 08:39 (UTC)


 * You have to edit MediaWiki:Monobook.js and attach the events to the specific spans and divs. MediaWiki doesn't allow inline JavaScript. Datrio 11:10, 5 May 2007 (UTC)


 * Thanks 2 U both, but I'm afraid I'll to have to study JavaScript in depth in order to understand this.
 * A different question: Is there a way to make a template behave differenly when the page is viewed in it's printable version? Ori229 12:24, 6 May 2007 (UTC)