Topic awaiting preservation: Couple javascript questions as I get back into the groove (Page 1 of 1) |
|
---|---|
Maniac (V) Inmate From: Yes |
posted 04-12-2005 15:45
I know that it use to be the norm to surround your javascript with HTML comments. Is this still necesary? Especially if you are importing your javascript from a file? I'm guessing no because I'd assume if the browser can't handle the js and need the comments it probably can't import them to begin with, but I'd like to hear a more educated jscripters thoughts =) code: if (something) {
code: if (something) {
|
Paranoid (IV) Inmate From: France |
posted 04-12-2005 16:20
[quick_reply] |
Maniac (V) Inmate From: Yes |
posted 04-12-2005 16:46
Wow P01 that was quick! Thanks for the tidbit about the comments, I'll get rid of 'em now, just wanted to make sure. code: var thisUri = document.URL;
code: alert(document.URL);
|
Paranoid (IV) Inmate From: France |
posted 04-12-2005 17:06
The quickness is pure luck |
Maniac (V) Inmate From: Yes |
posted 04-12-2005 17:35
Ahh, hehe, still I wonder what document.location is used for then since it is so similar to document.URL. Has to be a reason for having two of them. I look into window.location, but this document.URL method i put togethor seems to be doing fine. Also document.URL is read only, I'd hate to accidently set my window.location. code: function getWindowWidth() {
|
Paranoid (IV) Inmate From: France |
posted 04-12-2005 17:48
For the width, you can use the offsetWidth and offsetHeight properties on the body. But I don't know/remember if they include the scrollbars And you may need to parseInt() them. |