< script> page = { addImagePath: "~/Content/Themes/Flexigrid/Images/add.png", ... other server generated vars } </ script> < script src="client.js"></ script>Note that the order is important: The script block with the ~ must preceed the client script loading so that it's visible within there when that code fires and runs.
buttons: [ { name: 'Add', bclass: 'add', bimage: page.addImagePath, tooltip: 'Add new client', onpress: add }, ... ]+++ Rick ---
>Content > Themes > FlexiGrid > Images > add.png >>
>buttons: [ > { name: 'Add', bclass: 'add', bimage: '~/Images/add.png', tooltip: 'Add new client', onpress: add }, > { name: 'Edit', bclass: 'edit', tooltip: 'Edit selected client', onpress: edit }, > { name: 'Delete', bclass: 'delete', tooltip: 'Delete selected client', onpress: del }, > { separator: true } > ],>
>var btn = p.buttons[i]; > if (!btn.separator) { > var btnDiv = document.createElement('div'); > btnDiv.className = 'fbutton'; > btnDiv.innerHTML = ("<div><span>") + (btn.hidename ? " " : btn.name) + ("</span></div>"); > if (btn.bclass) $('span', btnDiv).addClass(btn.bclass).css({ > paddingLeft: 20 > }); > if (btn.bimage) // if bimage defined, use its string as an image url for this buttons style (RS) > $('span',btnDiv).css( 'background', 'url('+btn.bimage+') no-repeat center left' ); > $('span',btnDiv).css( 'paddingLeft', 20 ); > > if (btn.tooltip) // add title if exists (RS) > $('span',btnDiv)[0].title = btn.tooltip; > > btnDiv.onpress = btn.onpress; > btnDiv.name = btn.name;>