the topic might bit cryptic, here's problem (perhaps n00b-thing?):
for site have widget, user can use on site such (for example):
<script type="text/javascript"> var widget_width ="300"; </script> <script src="http://something/a.js" type="text/javascript"></script>
now, in .js file want check if user have declared widget_width variable. thought might (i want variable empty, "", because server-side validation too):
if(typeof widget_width == 'undefined') { var widget_width = ""; }
this didn't work, neither did:
if(!widget_width) { var widget_width = ""; }
any ideas on how declare variable when needed way?
remove var. make >
if(typeof widget_width == 'undefined') { widget_width = ""; }
Comments
Post a Comment