narayan Posted June 10, 2013 Report Share Posted June 10, 2013 How to use if else loop inside Html tag Quote Link to comment Share on other sites More sharing options...
MayMusic Posted June 10, 2013 Report Share Posted June 10, 2013 Here is a good source to get the syntax: http://www.w3schools.com/js/js_if_else.asp Quote Link to comment Share on other sites More sharing options...
narayan Posted June 10, 2013 Author Report Share Posted June 10, 2013 Actually I am asking about how to access a datapage value in html tag I am use the below code but its not working. <script> if( [@field:offer_sales_id]==[@sid]) ) { document.write("<input type='button' Value='Pending'>"); } else { document.write("<input type='button' Value='Create'>"); } </script> I am working on this from 2 days can't find the solution. Please help me ASAP. Quote Link to comment Share on other sites More sharing options...
MayMusic Posted June 11, 2013 Report Share Posted June 11, 2013 There is one extra parentheses in your code: if( [@field:offer_sales_id]==[@sid]) ) you also need " around the field and parameter values: <script> if( "[@field:offer_sales_id]"==[@sid]) ) { document.write("<input type='button' Value='Pending'>"); } else { document.write("<input type='button' Value='Create'>"); } </script> Quote Link to comment Share on other sites More sharing options...
narayan Posted June 11, 2013 Author Report Share Posted June 11, 2013 Hey, Thanks Its working 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.
Note: Your post will require moderator approval before it will be visible.