rossryan
asked on
Javascript and ASP.NET
I am trying to integrate some javascript code into a web user control. Unfortuantely, the page keeps throwing up errors when I try to view it.
I tried inserting directly into the formatting code (using <SCRIPT> tags), but to no avail. Then I tried using Response.Write. Still receiving errors. The javascript itself has no errors, and this is merely a test to get it in. Anybody have an idea what I am doing wrong?
Ryan
I tried inserting directly into the formatting code (using <SCRIPT> tags), but to no avail. Then I tried using Response.Write. Still receiving errors. The javascript itself has no errors, and this is merely a test to get it in. Anybody have an idea what I am doing wrong?
Ryan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<LINK href="1-800-FLOWERS_COM_fi les/styles .css" type=text/css rel=STYLESHEET>
<STYLE type=text/css>A.menuLink:l ink {
TEXT-DECORATION: none
}
A.menuLink:hover {
FONT-WEIGHT: bold; COLOR: #333333; TEXT-DECORATION: none
}
A.menuLink:active {
COLOR: #333333; TEXT-DECORATION: none
}
A.menuLink:visited {
TEXT-DECORATION: none
}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
var xPos,yPos;
xPos = 0;
yPos = 0;
var isNS = (navigator.appName == "Netscape" && parseInt(navigator.appVers ion) >= 4);
function showObject(object)
{
var lft,tp;
w1 = document.images["img1"].wi dth;
w2 = 345;
lft = xPos - (w2-w1);
tp = yPos;
object.left = lft + 11;
object.top = tp - 25;
object.borderColor = 'green';
object.visibility = VISIBLE;
}
function hideObject(object)
{
object.visibility = HIDDEN;
}
</SCRIPT>
</head>
<body>
<table>
<tr valign="top">
<td class="descriptText">
<div id="toEnlarge" class="toEnlarge">
<a href="#" onMouseover="showObject(de sc10)">
<img name="img1" src="http://shop.vixenhill.com/Images/GazeboImages/QA12ACopper.jpg"
width="120" height="120" border="0" alt="" align="right" hspace="0" vspace="0">
</a>
</div>
</td>
</tr>
</table>
<div id="desc10" name="desc10" CLASS="IsEnlarge" ALIGN=RIGHT>
<a href="#" onMouseOut="hideObject(des c10)">
<img name="bigimage" CLASS="col0" border="4" src="http://shop.vixenhill.com/Images/GazeboImages/QA12ACopper.jpg"
alt="" hspace="0" vspace="0" width="300" height="360"> </a>
</div>
<SCRIPT LANGUAGE="JavaScript">
var isNS = (navigator.appName == "Netscape" && parseInt(navigator.appVers ion) >= 4);
var HIDDEN = (isNS) ? 'hide' : 'hidden';
var VISIBLE = (isNS) ? 'show' : 'visible';
var toEnlarge = (isNS) ? document.toEnlarge : document.all.toEnlarge.sty le;
var desc10 = (isNS) ? document.desc10 : document.all.desc10.style;
</SCRIPT>
</body>
</html>
Hmm. Perhaps I should rephrase. I need the above code (Javascript section) to play nice with a repeater. Basically, I want the ASP code to grab the Javascript code, insert the image (via Container.Dataitem), and when the mous moves over it, I want to to enlarge from from a predefined size to the images max.
If I have missed anything, or if you need more information, please ask.
Thanks,
Ryan
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<LINK href="1-800-FLOWERS_COM_fi
<STYLE type=text/css>A.menuLink:l
TEXT-DECORATION: none
}
A.menuLink:hover {
FONT-WEIGHT: bold; COLOR: #333333; TEXT-DECORATION: none
}
A.menuLink:active {
COLOR: #333333; TEXT-DECORATION: none
}
A.menuLink:visited {
TEXT-DECORATION: none
}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
var xPos,yPos;
xPos = 0;
yPos = 0;
var isNS = (navigator.appName == "Netscape" && parseInt(navigator.appVers
function showObject(object)
{
var lft,tp;
w1 = document.images["img1"].wi
w2 = 345;
lft = xPos - (w2-w1);
tp = yPos;
object.left = lft + 11;
object.top = tp - 25;
object.borderColor = 'green';
object.visibility = VISIBLE;
}
function hideObject(object)
{
object.visibility = HIDDEN;
}
</SCRIPT>
</head>
<body>
<table>
<tr valign="top">
<td class="descriptText">
<div id="toEnlarge" class="toEnlarge">
<a href="#" onMouseover="showObject(de
<img name="img1" src="http://shop.vixenhill.com/Images/GazeboImages/QA12ACopper.jpg"
width="120" height="120" border="0" alt="" align="right" hspace="0" vspace="0">
</a>
</div>
</td>
</tr>
</table>
<div id="desc10" name="desc10" CLASS="IsEnlarge" ALIGN=RIGHT>
<a href="#" onMouseOut="hideObject(des
<img name="bigimage" CLASS="col0" border="4" src="http://shop.vixenhill.com/Images/GazeboImages/QA12ACopper.jpg"
alt="" hspace="0" vspace="0" width="300" height="360"> </a>
</div>
<SCRIPT LANGUAGE="JavaScript">
var isNS = (navigator.appName == "Netscape" && parseInt(navigator.appVers
var HIDDEN = (isNS) ? 'hide' : 'hidden';
var VISIBLE = (isNS) ? 'show' : 'visible';
var toEnlarge = (isNS) ? document.toEnlarge : document.all.toEnlarge.sty
var desc10 = (isNS) ? document.desc10 : document.all.desc10.style;
</SCRIPT>
</body>
</html>
Hmm. Perhaps I should rephrase. I need the above code (Javascript section) to play nice with a repeater. Basically, I want the ASP code to grab the Javascript code, insert the image (via Container.Dataitem), and when the mous moves over it, I want to to enlarge from from a predefined size to the images max.
If I have missed anything, or if you need more information, please ask.
Thanks,
Ryan
ASKER
Rewriting the script and throwing it in a .js file worked like a charm.
Thanks,
Ryan
Thanks,
Ryan
http://www.ondotnet.com/pub/a/dotnet/2003/09/15/aspnet.html
http://www.microsoft.com/indonesia/msdn/aspnet-injectclientsidesc.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIPageClassRegisterClientScriptBlockTopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIPageClassRegisterStartupScriptTopic.asp