Onmouseover

  • Thread starter Thread starter Frances Valdes
  • Start date Start date
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
 
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.
 
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.
 
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.
 
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


--
 
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
 
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.
 
Back
Top