ryel01 Posted November 13, 2006 Share Posted November 13, 2006 Hello!Can anyone show me how to property format the following code so it doesn't produce errors? What I'm trying to do is print the value assigned to "actualPrice" if it is over 0, otherwise print 0.[code]methodCell.innerHTML = '<input type="hidden" name="ShippingOptions[]" value="' + regionID + '|' + methodID + '|' + ( if (price > 0) { actualPrice } else { 0 } ) + '" />';[/code]Regan Quote Link to comment Share on other sites More sharing options...
Telemachus Posted November 13, 2006 Share Posted November 13, 2006 I'm thinking:[code]methodCell.innerHTML = '<input type="hidden" name="ShippingOptions[]" value="' + regionID + '|' + methodID + '|' + eval(parseFloat(price) > 0 ? parseFloat(actualPrice) : 0) + '" />'[/code]I'm just assuming floating points are involved, actualPrice has been set as a string, and price is a form field value ??? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.