Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

2 javascript code in the same webpage (first from Master Page, second from UserControl)

Posted on 2004-09-19
1
Medium Priority
?
388 Views
Last Modified: 2013-12-16
Hi Experts,

I use RegisterStartupScript function to add javascript to my webpage from this webpage and also from one of my usercontrols.
The problem is that I use the javascript event "onmousemove" in both scripts.

So the result is:

<script language='javascript'>
... my javascript code
document.onmousemove =movefrommaster;
</script>
<script language='javascript'>
... my javascript code
document.onmousemove =movefromusercontrol;
</script>

I can't manage my javascript code as I want if I use a usercontrol.

Thanks in advance for any help.
0
Comment
Question by:noulouk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 28

Accepted Solution

by:
mmarinov earned 2000 total points
ID: 12095338
Hi noulouk,

why don't you use a javascript function that will pass as a parameter which is the caller ( master page or user control ) and depends on this value to execute the certain code. the registering of call to this function will be executed again with RegisterStartupScript but will cover the needed functionality

<script language="Javascript">
function callOnMouseMove ( caller )
{
 if ( caller )
  document.onmousemove = movefrommaster;
 else
  document.onmousemove = movefromusercontrol;
}

</script>

and with the registerstartupscript will call from master page like
callOnMouseMove( true )
and from user control
callOnMouseMove ( false )
B..M
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question