Solved

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

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

617 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