sstangle73 Posted September 3, 2008 Share Posted September 3, 2008 im a noob at js why doesnt echo "<script language=\"JavaScript\" type=\"text/javascript\">document.getElementById('username').style.border='2px solid #FF0000';</script>"; work it just doesnt do anything. Quote Link to comment Share on other sites More sharing options...
lemmin Posted September 3, 2008 Share Posted September 3, 2008 That line would have to be echoed AFTER the line where your tag is with the id of "username." Also, the language property is deprecated so you only need the type property. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted September 3, 2008 Share Posted September 3, 2008 You can't use that kind of syntax with JavaScript. That's CSS, not JavaScript. :-\ Quote Link to comment Share on other sites More sharing options...
sstangle73 Posted September 4, 2008 Author Share Posted September 4, 2008 its called through ajax. i suppose that is the problem. any idea how to make it work. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted September 4, 2008 Share Posted September 4, 2008 its called through ajax. i suppose that is the problem. any idea how to make it work. It doesn't matter what it's called through. In JavaScript: border='2px solid #FF0000'; You can't use that syntax. http://www.w3schools.com/css/css_border.asp Use that site to specify each border values separately with JavaScript. That's the only way with JavaScript alone. The other way is to make a CSS class or ID with that value and just add the class using JavaScript. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted September 4, 2008 Share Posted September 4, 2008 its called through ajax. i suppose that is the problem. any idea how to make it work. It doesn't matter what it's called through. In JavaScript: border='2px solid #FF0000'; You can't use that syntax. http://www.w3schools.com/css/css_border.asp Use that site to specify each border values separately with JavaScript. That's the only way with JavaScript alone. The other way is to make a CSS class or ID with that value and just add the class using JavaScript. sure you can...it's perfectly fine to add a border with that syntax. the probably probably has to do with your AJAX. the javascript won't evaluate when you load it with standard AJAX methods. you have to parse the JS out of the contents returned and eval() it. i would use a JS library like jQuery or Prototype, as they will do this for you automatically. 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.