So how can I access a mason array using a _javascript_ indexer? (see the WHAT in code sample) ...
<script type="text/_javascript_">
  var size = <% scalar @sortedfiles %>;
  var imagearray = new Array(size);
  // do the for loop in _javascript_, not perl
  // ..etc
  for(i=0 ; i<size ; i++) {
    imagearray[i] = <% $masonarray[ WHAT ] %>
  }
</script>


Michael Reece wrote:
the perl is run at the time the _javascript_ is generated (server-side), not when the _javascript_ is executed (client-side).

you cannot mix perl and _javascript_ and get the behavior you are expecting.  you'll need to use _javascript_ variables there, not perl variables.

however, you can still initialize your _javascript_ variables from perl:

<script type="text/_javascript_">
  var size = <% scalar @sortedfiles %>;
  var imagearray = new Array(size);
  // do the for loop in _javascript_, not perl
  // ..etc
</script>

On Dec 7, 2006, at 5:12 PM, Kristian Nilssen wrote:

I am seeing a mason variable being incremented when the OnClick event 
handler which does the incrementing is never fired...

<script type="text/_javascript_">
% my $size = scalar @sortedfiles;
var imagearray = new Array(<%$size%>)
% for(my $i=0 ; $i<$size ; $i++) {
var img = new Image()
img.src = ""
imagearray[<%$i%>] = img
% }

function nextImage() {
alert("nextImage")
% $currentindex++; THIS IS BEING 'RUN'. WHY???
document.images.theimage.src = "" class="Apple-tab-span" style="white-space: pre;">
}
</script>


The currentindex is <%$currentindex%><br>  THIS BIT SAYS CURRENTINDEX==1
<form><input type=button value="next"></form>
<img src="" name="theimage" />

<%init>
my $currentindex = 0;
</%init>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
_______________________________________________
Mason-users mailing list

---
michael reece :: software engineer :: [EMAIL PROTECTED]


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to