mobone Posted June 11, 2009 Report Share Posted June 11, 2009 <td class="style3" style='width:75%'>I'd like the 75% to be a variable from my script. I'm just thrown off cause of the ' ', I could do it in PHP though!Thanks! Link to comment Share on other sites More sharing options...
justsomeguy Posted June 11, 2009 Report Share Posted June 11, 2009 You can't add Javascript like that, you would have to have a JS function that runs after that element gets created to update the style, or have a JS function create the element. Link to comment Share on other sites More sharing options...
mobone Posted June 11, 2009 Author Report Share Posted June 11, 2009 This prints a table with only 50% width, when it should be 100%. function print_everything() {hp_table='<table cellpadding="0" cellspacing="0" class="style2" style="width:100px"><tr><td class="style3" style=width:"';hp_table+=characters['opponent']['hp'];hp_table+='%"> </td><td> </td></tr></table>';} Link to comment Share on other sites More sharing options...
justsomeguy Posted June 11, 2009 Report Share Posted June 11, 2009 It looks like the style attribute is missing quotes around it.hp_table='<table cellpadding="0" cellspacing="0" class="style2" style="width:100px"><tr><td class="style3" style="width:';hp_table+=characters['opponent']['hp'];hp_table+='%"> </td><td> </td></tr></table>'; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now