katiana Δημοσ. 29 Μαρτίου 2008 Δημοσ. 29 Μαρτίου 2008 καλημερα...με τον παρακατω κωδικα εφτιαξα 2 sumit button και προσπαθω με onmouseover να αλλαξω το background και τον cursor ωστοσο οι λειτουργιες αυτες δουλευουν μονο για το πρωτο κουμπι.Συγκεκιμενα οταν τοποντικι βρισκεται ανω στο 1ο δουλευουν και οι δυο λειτουγιες για το ιδιο κουμπι ενω οταν βρισκεται στο 2ο αλλαζει μονο το background του 1ου.θα μπορουσε καποιος εμπειρος να με βοηθησει?ευχαριστω προκαταβολικα <html> <head> <script type="text/javascript"> function changeColor(color) { document.getElementById('x').style.background=color; } function changeCursor(cursor) { document.getElementById('x').style.cursor=cursor; } </script> </head> <body bgcolor="silver"> <FORM METHOD=POST ACTION="selida.php"> <table border="0" style="position: absolute; top: 80%; left: 35%"> <tr> <td><input id="x" class="red" type="submit" value="ok" onmouseover="changeColor('#cc0000'); changeCursor('hand')" onmouseout="changeColor('red'); changeCursor('default')"> <td><input id="x" class="red" type="submit" value="cansel" onmouseover="changeColor('#cc0000'); changeCursor('hand')" onmouseout="changeColor('red'); changeCursor('default')"> </tr></table> <style type=text/css> input.red {background-color: 'red'; font-weight: bold; font-size: 25px; color: white;} input.red {background-color: 'red'; font-weight: bold; font-size: 25px; color: white;} </style> </FORM> </body></html>
alex2005 Δημοσ. 29 Μαρτίου 2008 Δημοσ. 29 Μαρτίου 2008 Έχεις και στα δύο κουμπιά το ίδιο id. Μάλλον αυτό είναι το πρόβλημά σου. Μπορείς να κάνεις το εξής: Κάνε το script: > <script type="text/javascript"> function changeColor(color,element) { element.style.background=color; } function changeCursor(cursor,element) { element.style.cursor=cursor; } </script> Και τα κουμπιά σου να είναι: > <input id="x" class="red" type="submit" value="ok" onmouseover="changeColor('#cc0000',[b]this[/b]); changeCursor('hand',[b]this[/b])" onmouseout="changeColor('red',[b]this[/b]); changeCursor('default',[b]this[/b])"> Δεν το έτρεξα για να είμαι 100% σίγουρος ότι παίζει...αλλά δοκίμασε και πες μου αν δουλεύει.
HighT3ch Δημοσ. 29 Μαρτίου 2008 Δημοσ. 29 Μαρτίου 2008 > <input type="submit" style="cursor: pointer; background-color: #ff0000" onMouseOver="this.style.backgroundColor='#00ff00'" onMouseOut="this.style.backgroundColor='#ff0000'" value="Submit"/> <input type="reset" style="cursor: pointer; background-color: #ff0000" onMouseOver="this.style.backgroundColor='#0000ff'" onMouseOut="this.style.backgroundColor='#ff0000'" value="Cancel"/>
Προτεινόμενες αναρτήσεις
Αρχειοθετημένο
Αυτό το θέμα έχει αρχειοθετηθεί και είναι κλειστό για περαιτέρω απαντήσεις.