If your WebSlices use the Basic Web Slice model, javascript will not work (this file is WebSlice.html):
<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">
<title></title>
</head>
<body>
<div class="hslice" id="SliceID">
<span class="entry-title">Title of the web slice</span>
<div class="entry-content">Preview of the <a href="#" onclick="document.getElementById('Message').innerHTML='Hello'; return false;">web</a> slice
<div id="Message"></div>
</div>
<p>
Hola Rebanadas Web!
</p>
</div>
</body>
</html>
you have to use Alternative Display Source to make javascript work (this file is WebSlice.html):
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div class="hslice" id="SliceID">
<span class="entry-title">Title of the web slice</span>
<a rel="entry-content" href="AlternativeDisplay.html" style="display:none;">Alternative Display Source</a>
<p>
Hola Rebanadas Web!
</p>
</div></body>
</html>
and in the file AlternativeDisplay.html you put the code that use to be in WebSlice.html (and that needs to use javascript):
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div class="entry-content">Preview of the <a href="#" onclick="document.getElementById('Message').innerHTML='Hello'; return false;">web</a> slice
<div id="Message"></div>
</div>
</body>
</html>