I would like to pass on a spry data element into a javascript
function to do some math. An easy example would be if:
{price} and {sale-price} where the two data elements
<div>Price: {price}</div>
<div>Sale Price: {sale-price}</div>
<div>Discount Percentage</div><div
id=”savings”>0.00%</div>
<script>
pctsaving(‘savings’,'{price}’,'{sale-price}’);
</script>
pctsaving function will set the div value named ‘savings’ to
(1-(a/b))*100.
This will work find and dandy with numbers, but DW CS3 seems
not to like to pass on the spry elements to javascript, it replaces
the {price} with:
<script language=”javascript”>
pctsaving(‘saving’,<MM:BeginLock translatorClass=”MM_SPRY”
type=”MM_SPRY_DATA_REFERENCE” orig=”<MM:BeginLock
translatorClass=”MM_SPRY” type=”MM_SPRY_DATA_REFERENCE”
orig=”{price}” ><MM_DYNAMIC_CONTENT
DYNAMICDATA=1><MM:DECORATION HILITECOLOR=”Dyn Untranslated
Color”>{price}</MM:DECORATION></MM_DYNAMIC_CONTENT></script><MM:EndLo ck>”
><MM_DYNAMIC_CONTENT DYNAMICDATA=1><MM:DECORATION
HILITECOLOR=”Dyn Untranslated
Color”>{price}</MM:DECORATION></MM_DYNAMIC_CONTENT></script><MM:EndLo ck>,{sale-price});
</script>
Any ideas?|||
Hi,
I have the same problem, although I do not get the
“MM-stuff”, may be due to the fact that I coded by hand (simply
using a demo code). I created a master/detail dataset relating
filenames (master) with coordinate files to be displayed in a
jmol-applet window:
<div id=”Mols_DIV” spry:region=”dsMols”>
<table id=”Mols_Table”>
<tr>
<th>Id</th>
<th>menuname_mol</th>
</tr>
<tr spry:repeat=”dsMols”
onclick=”dsMols.setCurrentRow(‘{ds_RowID}’)”>
<td>{id_mol}</td>
<td>{menuname_mol}</td>
</tr>
</table>
</div>
<div id=”Mols_Detail_DIV” spry:detailregion=”dsMols”>
<table id=”Mols_Detail_Table”>
<tr>
<th>Filename</th>
<th>Title</th>
</tr>
<tr>
<td><a
href=”../files/mol/pdb/{molfile_mol}”>{molfile_mol}</a></td>
<td>{title_mol}</td>
<td>{ds_RowNumber}</td>
</tr>
</table>
<script type=”text/javascript”
language=”JavaScript1.2″>
jmolInitialize(‘../../jmol/’);
jmolApplet(300, “load ../files/mol/pdb/{molfile_mol}”);
</script>
</div>
</body>
The problem is that the spry elements were not evaluated,
they were displayed as {molfile_mol} if the page loads. The applet
complains logically about the wrong filename, but after a while the
first element gets converted to the correct filename and the
molecule displays within the applet window. Unfortunately this is
all what happens; only the applet is left on the page, nothing else
and the browser (FF) hangs …
Any clue whats going on here?
Thanks Michael
Related posts:
- Passing spry xml data into javascript
- Spry Data PagedView Problem
- Calling a JavaScript function on Spry data?
- processTokens: Failed to get a data set context!
- Spry XML Data won’t diplay – Help
Related posts brought to you by Yet Another Related Posts Plugin.