Onmouseover

F

Frances Valdes

I'm a newbie.

I'm trying to use asp and javascript to put text into a text box when I put
a mouse over a button and a web form. On page load I have used
"Button1.Attributes.Add("onmouseover", "javascript:form1.TextBox1.text='this
works')"

Nothing happens when I put the mouse over. I can use the same script to
change the background colour of the document or to raise a javascript alert
box. However I cannot access a textbox - I've tried to make it invisible and
this doesn't work either. I should mention that I'm using visual studio.net
and putting the code in the aspx.vb file.

Please can someone let me know why I can't have access to the textbox.
Thanks
 
K

Kevin Spencer

Have you looked at the HTML code generated to see what the problem is?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
F

Frances Valdes

This is probably very stupid but I don't know how to get at the html code. I
assume you don't mean the code which is created by visual studio on the aspx
html page, but the code which is generated when the page is compiled.
 
F

Frances Valdes

I've solved my problem.

It seems that despite there being a textbox1.text property, if I want to
programatically add text I have to use textbox1.value. I'd be interested to
know why if anyone can tell me, but at least this part of my code now works.
 
P

Patrice Scribe

Yes,

The server side TextBox class exposes a Text property. Client side the
generated HTML code is an <input type="text"> tag with its usual value
attribute...

If you use htmlControls (instead of WebControls) you'll have a model that is
closely related to the client side counterpart but with less abstraction and
type safety...

Patrice


--
 
F

Frances Valdes

Thanks for that - its now clear.


Patrice Scribe said:
Yes,

The server side TextBox class exposes a Text property. Client side the
generated HTML code is an <input type="text"> tag with its usual value
attribute...

If you use htmlControls (instead of WebControls) you'll have a model that is
closely related to the client side counterpart but with less abstraction and
type safety...

Patrice
 
K

Kevin Spencer

Hi Frances,

For future reference, to see the HTML code, when the page is loaded in the
browser, right-click and select "View Source" from the context menu.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Onmouseover 1
onmouseover repeat 2
OnMouseOver Help Box 5
Change class with onmouseover 3
Changing a background-color 2
Simple Program 0
I know VBA (macros) - nothing else! 0
css - onmouseover 24

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top