By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,568 Members | 1,196 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,568 IT Pros & Developers. It's quick & easy.

Mouse over stuff

P: n/a
I would like to write script (lkike in gmail) that from a SELECT html
object I should choose which option can be selected and which not.

I mean that I can't move mouse over them:

<select name="select">
<option id="disa" onMouseOver="script();"> No way</option>
<option id="disb" onMouseOver="script();">No way</option>
<option id="disc" onMouseOver="script();">No way</option>
<option>Ok</option>
<option>Ok</option>
</select>

I tried with blur() but this solution closes select.

Any help appreciated.

Regards.

--
Gibe si è fatto passare perchè Rossi dietro è come una purga, prima o
poi una cagata te la fa fare...!
Sep 27 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
Fabri wrote:
I would like to write script (lkike in gmail) that from a SELECT html
object I should choose which option can be selected and which not.

I mean that I can't move mouse over them:

<select name="select">
<option id="disa" onMouseOver="script();"> No way</option>
<option id="disb" onMouseOver="script();">No way</option>
<option id="disc" onMouseOver="script();">No way</option>
<option>Ok</option>
<option>Ok</option>
</select>

I tried with blur() but this solution closes select.

Any help appreciated.

Regards.


Hi,

I think you better remove invalid entries from the select-box, based on some
criteria you didn't mention, but I guess you know them. :-)
You can dynamically add and remove OPTIONS from a SELECT.

Here is some example-code:

http://www.quirksmode.org/js/options.html

Good luck

Regards,
Erwin Moller

Sep 27 '05 #2

P: n/a
Erwin Moller wrote:
Hi,

I think you better remove invalid entries from the select-box, based on some
criteria you didn't mention, but I guess you know them. :-)
You can dynamically add and remove OPTIONS from a SELECT.

Thx Erwin I think you are right.

However I'm curious about the way I could do what I mentioned.

Regards.

--
Gibe si è fatto passare perchè Rossi dietro è come una purga, prima o
poi una cagata te la fa fare...!
Sep 27 '05 #3

P: n/a
Fabri wrote:
Erwin Moller wrote:
Hi,

I think you better remove invalid entries from the select-box, based
on some criteria you didn't mention, but I guess you know them. :-)
You can dynamically add and remove OPTIONS from a SELECT.


Thx Erwin I think you are right.

However I'm curious about the way I could do what I mentioned.


Set the disabled attribute of the option to true - but make sure it
isn't selected first (set the focus to some other option).
<form action="">
<select name="Asel">
<option>Fred
<option>Sam
<option>Tim
</select>
<input type="button" value="Disable Sam" onclick="
this.form.Asel.options[0].selected = true;
var x = this.form.Asel.options[1];
x.disabled = !x.disabled;
this.value = (x.disabled)?'Enable Sam':'Disable Sam';
">
</form>
--
Rob
Sep 27 '05 #4

P: n/a
RobG wrote:
Set the disabled attribute of the option to true


[cut]
Awesome RobG :-)

--
Gibe si è fatto passare perchè Rossi dietro è come una purga, prima o
poi una cagata te la fa fare...!
Sep 27 '05 #5

P: n/a
RobG <rg***@iinet.net.au> wrote in message news:43***********************@per-qv1-newsreader-01.iinet.net.au...
Fabri wrote:
Erwin Moller wrote:
Hi,

I think you better remove invalid entries from the select-box, based
on some criteria you didn't mention, but I guess you know them. :-)
You can dynamically add and remove OPTIONS from a SELECT.


Thx Erwin I think you are right.

However I'm curious about the way I could do what I mentioned.


Set the disabled attribute of the option to true - but make sure it
isn't selected first (set the focus to some other option).

I.E. doesn't seem to support that attribute for select options, and whilst Opera does,
clicking on the disabled option can cause an adjacent option to be selected.
I think selective-depopulation must be preferable.

--
S.C.


Sep 27 '05 #6

P: n/a
Stephen Chalmers wrote:
RobG <rg***@iinet.net.au> wrote in message news:43***********************@per-qv1-newsreader-01.iinet.net.au...

[...]

Set the disabled attribute of the option to true - but make sure it
isn't selected first (set the focus to some other option).


I.E. doesn't seem to support that attribute for select options, and whilst Opera does,
clicking on the disabled option can cause an adjacent option to be selected.
I think selective-depopulation must be preferable.


C'est la vie.

I didn't test it in IE, I just expected it to work - giving the option a
disabled attribute in the HTML source doesn't work either.

Maybe IE 7 will behave?
--
Rob
Sep 27 '05 #7

P: n/a
RobG wrote:
Stephen Chalmers wrote:
RobG <rg***@iinet.net.au> wrote in message
news:43***********************@per-qv1-newsreader-01.iinet.net.au...

[...]

Set the disabled attribute of the option to true - but make sure it
isn't selected first (set the focus to some other option).


I.E. doesn't seem to support that attribute for select options, and
whilst Opera does, clicking on the disabled option can cause an adjacent
option to be selected. I think selective-depopulation must be preferable.


C'est la vie.

I didn't test it in IE, I just expected it to work - giving the option a
disabled attribute in the HTML source doesn't work either.

Maybe IE 7 will behave?


And if not IE7, we can always hope for IE8. Or IE9.

Let's all go Gecko now!, oh happy day!
;-)

Regards,
Erwin Moller
Sep 27 '05 #8

P: n/a
Stephen Chalmers wrote:
I.E. doesn't seem to support that attribute for select options, and whilst Opera does,
clicking on the disabled option can cause an adjacent option to be selected.
I think selective-depopulation must be preferable.

Good find!

What about Gmail script?

How can it go work?
--
Sign failure
Sep 27 '05 #9

P: n/a
Fabri wrote:
What about Gmail script?
How can it go work?

Sorry. It doesn't work on Gmail too.

--
Sign failure
Sep 27 '05 #10

P: n/a
Hi,

Why not using labels? More info here:
http://www.htmlhelp.com/reference/ht.../optgroup.html

regards,
claudiu

*** Sent via Developersdex http://www.developersdex.com ***
Oct 3 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.