Results 1 to 2 of 2

Thread: [RESOLVED] [2008] Javascript in a Web User Control

  1. #1

    Thread Starter
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Resolved [RESOLVED] [2008] Javascript in a Web User Control

    I'm having a problem - hope someone can help.

    I am developing a website using ASP.Net, the basic layout is governed by a master page with a header, footer and left column, and then a content block in the middle.

    I am building a user control to basically handle the left-column which is basically a menu of links which is made up graphically of a few images layered on top of each other. I want to implement roll-over highlighting of options, so I've taken some existing javascript which I know works fine to pre-load the images, and to handle the switching on mouse over and exit.

    The problem I have is that when I run a page with this control on it, the code is failing because its looking for the javascript routine within the body of the page that is hosting the control, not within the control itself.

    So my question - is it possible to embed the javascript within the control? Is it just a case of needing to explicitly referencing the control?

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [RESOLVED] [2008] Javascript in a Web User Control

    How did you place the javascript in the control in the first place? If you want to embed it directly you could always place it within <script> tags in the controls

    Code:
    <script type="text/JavaScript">
    function abc()
    {
    ...
    }
    </script>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width