Solved

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

Posted on 2004-09-19
1
385 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 500 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
hbo knew my windows software 4 76
What are the simplest ways to create a Merge Sort? 3 37
Why use this lambda? 12 68
Multi-Column Repeater 3 29
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
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 prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

696 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