Getting Object cannot be created in this context"code 9" trying to call javascript function

What’s up guys, anyone seen this before, using rails 2.0.2,
If I put a button on the page and try and call this javascript
function all works well, but if I use rjs to call this javascripot
function that is defined in my layout, I ge the above error, I can
call the same function if it contains something simple like an alert
box, but it seems to freak out on new element(‘div’) which is a
mootools thing.

Any ideas?

my view: call_it.rhtml
<%=render :update do |page|
page << ’ ’
end
%>

my layout

Your title
  function myfunction(src)
  {

    container = new Element('div').setStyles({
      position: 'absolute',
      top: 0,
      left: 0,
      overflow: 'hidden',
      width: '100%',
      height: window.getHeight()+'px'
      //background: '#00C'
    });}

</script>
<%#* <%#*onclick="myfunction('/pics/test1.jpeg')"%> <%#*value="Call function">%> <%#*%>
<%= yield :layout %>

On 9 Mar 2008, at 17:47, sweiss wrote:

my view: call_it.rhtml
<%=render :update do |page|
page << ’ ’
end
%>

If you are using rjs then you definitely don’t want to stick page << ’

' there. The browser is already evaluating what you render as javascript and isn't a legal piece of js. Fred