By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,874 Members | 1,028 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,874 IT Pros & Developers. It's quick & easy.

Different behaviour for hardcoded scripts and saved in a file

P: 1
I have a couple problems which I think they need attention from someone a bit more experienced in web developpement than I am.
I want to change the text of an ASP:Label (Server Side), every time the user hovers the mouse on a client-side object.
I manage to make that work with the script I attach below, however the problems raise when I try to make my code a bit more efficient.
Ideally, I'd like to parse the "S" variable to the server like that:
[b]document.getElementById('<%=Master.ActiveLbl.Clien tID%>').innerText="'<%'" + s + "'%>'";[/B]

But as we probably all know this syntax is not possible to provide the realtime result I want. Then, if the ideal solution is not possible, I try to include my script in a JScript File so I will not have to hard code all of these Switch,Case in every page of my website. However, even though when they are hardcode, the following code works fine. When I load it with the JScript file, I get a 'document.getElementById(...)' is null or not an object runtime script error.
Any ideas???
Thank you in advance, the script's code follows...

<script type="text/javascript" >
function MouseOver(S)
var sStringToShow;
switch (S)

case "BuildingVal": sStringToShow='<%=MyAppData.MouseOverBuildingVal%> ';
case "ContentVal": sStringToShow='<%=MyAppData.MouseOverContentVal%>' ;
case "PostCode":sStringToShow='<%=MyAppData.MouseOverPo stCode%>';
case "Tenancy": sStringToShow='<%=MyAppData.MouseOverTenancy%>';
case "getQQuote": sStringToShow='<%=MyAppData.MouseOvergetQQuote%>';
default: sStringToShow=S;
document.getElementById('<%=Master.ActiveLbl.Clien tID%>').innerText = sStringToShow;


function MouseOut()
document.getElementById('<%=Master.ActiveLbl.Clien tID%>').innerText='<%=activeLblContent%>';
// -->
//change the text in an asp:Label from client side
Mar 5 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.