name versus id
just a quick question about name and id for attributes with img tag.
i know name is deprecated, and that id can be used with css, but if one gives a value to and id tag, can it also be used for javascript?
ie: i have a set of graphical links that flip out between two images. if i use an id i know i can asign css values that will allow me to remove the border, set sizes, etc.
if i use javascript and write for html 4.01 but try to be forward compatabil to xhtml 1.0, how does one set the javascript to use the id tag? is it the same as when using the name? (document.name.value()
i haven't used ids to access javascript before and haven't seen anything that gives a definitive answer to this. pretty much all i can find is that name has been deprecated for use of id, and not supported in xhtml 1.0 strict
POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.
Suzanne posted this at 23:48 — 21st December 2003.
She has: 5,507 posts
Joined: Feb 2000
http://www.phpnoise.com/reference/xhtml/guidelines.html
So, really, it shouldn't affect the JavaScript to continue to use name for now in other elements, but JavaScript should be able to use id -- I use it on my page with id only.
I find that it's easier to use name AND id because PHP doesn't recognize only id for form elements.
m3rajk posted this at 00:02 — 22nd December 2003.
They have: 461 posts
Joined: Jul 2003
thanx. if you'd like to look at what i am using it for just go to http://24.91.157.113/findyourdesire/index.php
and then check the source. one of the people who said they were interested in graphics finally started making some, and liked how i had the text change since the colors were so similatr and wants to have the images flip out. i want to be forward compatible, and to be able to stop the border from showing, so i firgured i'd ask about the id and make sure i can use itlike name... only thing right now is that a quick fix for the function didn't work, so i guess i'll test the which to find which thing to switch (i feel like my name should be theodore guissel (sp?) after that last sentance)
POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.
m3rajk posted this at 01:12 — 22nd December 2003.
They have: 461 posts
Joined: Jul 2003
umm.. javascript seems to be not working. not quite sure why. pointers would be appreciated.
Suzanne posted this at 03:03 — 22nd December 2003.
She has: 5,507 posts
Joined: Feb 2000
function selopt(which){ // switch what is selected
switch(which){ // which switch is executed?
case 'chat': document.login.src=chaton.src; return true;
case 'faq': document.login.src=faqon.src; return true;
case 'finduser': document.login.src=finduseron.src; return true;
case 'forums': document.login.src=forumson.src; return true;
case 'login': document.login.src=loginon.src; return true;
case 'logout': document.login.src=logouton.src; return true;
case 'signup': document.login.src=signupon.src; return true;
}
Where are your break lines?
http://cyberlearn.fau.edu/cafolla/progjava/Switch.htm
function selopt(which){ // switch what is selected
switch(which){ // which switch is executed?
case 'chat':
document.login.src=chaton.src
return true
break
case 'faq':
document.login.src=faqon.src
return true
break
}
m3rajk posted this at 05:44 — 22nd December 2003.
They have: 461 posts
Joined: Jul 2003
i was fashioning it after something in a book on it... and got it working without breaks. i found it odd that the book didn't have break. breaks now included
POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.
Suzanne posted this at 17:18 — 22nd December 2003.
She has: 5,507 posts
Joined: Feb 2000
if you got it working without breaks, which part of the javaScript isn't working for you?
m3rajk posted this at 20:36 — 28th December 2003.
They have: 461 posts
Joined: Jul 2003
mozilla's error detection engine was complaining about the sources for the picture
m3rajk posted this at 20:43 — 28th December 2003.
They have: 461 posts
Joined: Jul 2003
i do have a somewhat related issue now though....
http://24.91.157.113/findyourdesire/
the finduser button is suppossed to go "on" and "off" like the rest of them.. problem is that if i have the onmouseout and onmouseover in with the input tag, it doesn't work.
the mozilla java console complains document.finduser has no properties.
i don't understand why. i have both name and id used.
i never checked the console when it was in the form tag, but it did not work then either. right now i'm searching for how to get the image swap to work there. figured a break to see if there's any help i could offer others would be good. didn't think this thread was still alive.
POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.
Suzanne posted this at 23:04 — 28th December 2003.
She has: 5,507 posts
Joined: Feb 2000
I don't believe you can set a hover state (with js nor css) for images used as submit buttons.
m3rajk posted this at 00:17 — 29th December 2003.
They have: 461 posts
Joined: Jul 2003
darn. that would be why i can't seem to get it to work. =o(
even tried adding in the form name and switching to onkeydown/onmousedown onkeyup/onmouseup and that didn't even get it to work while being selected.
so who do i email incessantly to get that ability added on?o)
POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.
Suzanne posted this at 01:41 — 29th December 2003.
She has: 5,507 posts
Joined: Feb 2000
ha!
well you could pass the variables using javascript, I suppose through the hyperlink, but it'd probably be easier to not have a hover state for that button...
m3rajk posted this at 15:29 — 29th December 2003.
They have: 461 posts
Joined: Jul 2003
one of the refrences i have says onblur and onfocus are suppossed to work. i tried them. they don't. so it's definitely a functionality i want added!
i'd rather not go through the trouble of a hyperlink and normal button, so unless the graphics person is insistent i think it'll just have the off state.
POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.