![]() |
Setting onMouseOver and onMouseOut on dynamic objects
Dear friends,
Is there a way to set onMouseOver and onMouseOut on dynamic objects? I need to create two javascript events: onMouseOver="show_message(id)" onMouseOut="show_message(id)" My objects are created as follows: Dim ID as String ID = "hyperlink1" Dim myHyperLink as HyperLink myHyperLink = New HyperLink myHyperLink.ID = ID myHyperLink.ImageUrl = "http://localhost/img.gif" PlaceHolder1.Controls.Add(myHyperLink) ID = "image1" Dim myImage as Webcontrols.Image myImage = New WebControls.Image myImage.ID = ID myImage.ImageUrl = "http://localhost/" PlaceHolder1.Controls.Add(myImage) ID = "label1" Dim myLabel as Label myLabel = New Label myLabel.ID = ID myLabel.Text = "my label" PlaceHolder1.Controls.Add(myLabel) |
Re: Setting onMouseOver and onMouseOut on dynamic objects
Sure, use the Add method of the attributes collection like so:
myHyperLink.Attributes.Add("onMouseOver","show_mes sage(id)") Of course, this has to be done before the control is added to the placeholder. Hope this helps, Mark Fitzpatrick Microsoft MVP - FrontPage "Robson Carvalho Machado" <RobsonCarvalhoMachado@discussions.microsoft.com > wrote in message news:D93EE0B9-314F-4CE4-8C5B-9BD12F0B0F7D@microsoft.com... > Dear friends, > > Is there a way to set onMouseOver and onMouseOut on dynamic objects? > > I need to create two javascript events: > onMouseOver="show_message(id)" > onMouseOut="show_message(id)" > > My objects are created as follows: > > Dim ID as String > > ID = "hyperlink1" > Dim myHyperLink as HyperLink > myHyperLink = New HyperLink > myHyperLink.ID = ID > myHyperLink.ImageUrl = "http://localhost/img.gif" > PlaceHolder1.Controls.Add(myHyperLink) > > ID = "image1" > Dim myImage as Webcontrols.Image > myImage = New WebControls.Image > myImage.ID = ID > myImage.ImageUrl = "http://localhost/" > PlaceHolder1.Controls.Add(myImage) > > ID = "label1" > Dim myLabel as Label > myLabel = New Label > myLabel.ID = ID > myLabel.Text = "my label" > PlaceHolder1.Controls.Add(myLabel) > > > > |
Re: Setting onMouseOver and onMouseOut on dynamic objects
Dear Mark,
Thaks a lot. "Mark Fitzpatrick" wrote: > Sure, use the Add method of the attributes collection like so: > myHyperLink.Attributes.Add("onMouseOver","show_mes sage(id)") > > Of course, this has to be done before the control is added to the > placeholder. > > Hope this helps, > Mark Fitzpatrick > Microsoft MVP - FrontPage > > "Robson Carvalho Machado" <RobsonCarvalhoMachado@discussions.microsoft.com > > wrote in message news:D93EE0B9-314F-4CE4-8C5B-9BD12F0B0F7D@microsoft.com... > > Dear friends, > > > > Is there a way to set onMouseOver and onMouseOut on dynamic objects? > > > > I need to create two javascript events: > > onMouseOver="show_message(id)" > > onMouseOut="show_message(id)" > > > > My objects are created as follows: > > > > Dim ID as String > > > > ID = "hyperlink1" > > Dim myHyperLink as HyperLink > > myHyperLink = New HyperLink > > myHyperLink.ID = ID > > myHyperLink.ImageUrl = "http://localhost/img.gif" > > PlaceHolder1.Controls.Add(myHyperLink) > > > > ID = "image1" > > Dim myImage as Webcontrols.Image > > myImage = New WebControls.Image > > myImage.ID = ID > > myImage.ImageUrl = "http://localhost/" > > PlaceHolder1.Controls.Add(myImage) > > > > ID = "label1" > > Dim myLabel as Label > > myLabel = New Label > > myLabel.ID = ID > > myLabel.Text = "my label" > > PlaceHolder1.Controls.Add(myLabel) > > > > > > > > > > > |
| All times are GMT. The time now is 10:10 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.