| | |
.js references from content to master don't work
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Nov 2008
Posts: 4
Reputation:
Solved Threads: 0
Hi, I'm having this problem and can't get a solution anywhere.
-- <Introduction:>
I have a master page, then I have a content page which contains a little login form wrapped in <div id="LoginTable"></div>
What I want, is to use a ScriptaculoUs JavaScript
Effect.Highlight(...)
on some mouseovers.
The Effect.Highlight is in external .js file. Scriptaculous uses also Prototype.
--<Problem>
On a standalone page it worked fine,
I referenced the "Scriptaculous.js" and "Prototype.js" in the <head> tags,
then I added a <script> tag with a function: HiEffect(element){ Effect.Highlight(...) }
then I added onmouseover="HiEffect(this)" to the element.
Everything worked fine until I had to put this page under a MasterPage.
Now, even if I reference the files in the MasterPage or ContentPage, the script won't run.
--<What Worked>
I tried instead of putting Effect.Highlight() something regular, like alert("lol") and the mouseover worked, so OK, the <script> can be found.
Then I checked if the element can be found, Yes, it is found.
So the problem surely is in the reference to the external .js file.
Where to put it, or how to force the page to know where to look for it?
Does anyone know, please let me know, thanx a lot.
-- <Introduction:>
I have a master page, then I have a content page which contains a little login form wrapped in <div id="LoginTable"></div>
What I want, is to use a ScriptaculoUs JavaScript
Effect.Highlight(...)
on some mouseovers.
The Effect.Highlight is in external .js file. Scriptaculous uses also Prototype.
--<Problem>
On a standalone page it worked fine,
I referenced the "Scriptaculous.js" and "Prototype.js" in the <head> tags,
then I added a <script> tag with a function: HiEffect(element){ Effect.Highlight(...) }
then I added onmouseover="HiEffect(this)" to the element.
Everything worked fine until I had to put this page under a MasterPage.
Now, even if I reference the files in the MasterPage or ContentPage, the script won't run.
--<What Worked>
I tried instead of putting Effect.Highlight() something regular, like alert("lol") and the mouseover worked, so OK, the <script> can be found.
Then I checked if the element can be found, Yes, it is found.
So the problem surely is in the reference to the external .js file.
Where to put it, or how to force the page to know where to look for it?
Does anyone know, please let me know, thanx a lot.
•
•
Join Date: Nov 2008
Posts: 4
Reputation:
Solved Threads: 0
Aw, yes, sorry.
this is my master Page:
this is my content Page:
the table goes on, but it is not important.
codebehind files are also not important.
What this is doing: When the page loads, the <div> 'LoginTable' should appear slowly.
ERROR messages. Yes, I use Firebug and it tells me this:
Effect is not defined:
Effect.Appear(elem, { duration: 2.0 })
So it is obvious that the external file effects.js cannot be found.
I know I don't need to put the <script> reference to effects.js, because the file scriptaculous.js loads it itself, but still, the file can not be found or what.
hope this helps, thx.
this is my master Page:
html Syntax (Toggle Plain Text)
<head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/> <title>my web</title> <link rel="stylesheet" type="text/css" href="StyleSheet.css" /> <script src="/Javascript/prototype.js" type="text/javascript"></script> <script src="/Javascript/scriptaculous.js" type="text/javascript"></script> <script src="/Javascript/effects.js" type="text/javascript"></script> <script type="text/javascript" language="javascript"> function mp_onload() { if(window.body_onload != null) window.body_onload(); } </script> <script type="text/javascript"> function EffectAppear(elem) { Effect.Appear(elem, { duration: 2.0 }) } </script> </head> <body onload="mp_onload()"> <form id="form1" runat="server"> <div> <asp:contentplaceholder id="ContentPlaceHolder1" runat="server"> </asp:contentplaceholder> </div> </form> </body> </html>
this is my content Page:
html Syntax (Toggle Plain Text)
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" Title="Login" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <script type="text/javascript" language="javascript"> function body_onload() { EffectAppear(findTable()); } function findTable() { var tab = '<%= LoginTable.ClientID %>'; return tab; } </script> <div> <table cellpadding="0" cellspacing="0" style="width:100%; height:100%;"> <tr style="height:30%;"> <td style="width:43%;"></td> <td style="width:14%; height: 150px;" align="center" valign="bottom"> <asp:Label ID="Label4" runat="server" ForeColor="Red" Text="Message" Visible="False"></asp:Label></td> <td style="width:43%;"></td> </tr> <tr style="height:20%;"> <td style="width:43%;"></td> <td style="width:14%;"> <div id="LoginTable" class="dialog" style="display:none;" runat="server"> <div class="content"> <div class="t"></div> <table cellspacing="0" style="width:100%; height:100%; border-right: black 0px solid; border-top: black 0px solid; border-left: black 0px solid; border-bottom: black 0px solid;" border="2"> <tr> <td colspan="2" align="center" style="border-right: 0px solid; border-top: 0px solid; border-left: 0px solid; border-bottom: 0px solid;"> <asp:Label ID="Label1" runat="server" Text="Prihlásenie"></asp:Label></td> </tr> </table>
codebehind files are also not important.
What this is doing: When the page loads, the <div> 'LoginTable' should appear slowly.
ERROR messages. Yes, I use Firebug and it tells me this:
Effect is not defined:
Effect.Appear(elem, { duration: 2.0 })
So it is obvious that the external file effects.js cannot be found.
I know I don't need to put the <script> reference to effects.js, because the file scriptaculous.js loads it itself, but still, the file can not be found or what.
hope this helps, thx.
•
•
Join Date: Nov 2008
Posts: 4
Reputation:
Solved Threads: 0
WHAT THE HELL?
I resolved it by accident. I almost gave up.
I simply moved the <script> references
from the <head> of the Master Page
into the <body><form> tag
and it worked...
lol, I spent hours googling around and found nothing.
I Hope if anybody`s got this noob (that`s me) problem, here is the solution.
Anyway, thanx Drew, and to everybody who wanted to help
I resolved it by accident. I almost gave up.
I simply moved the <script> references
from the <head> of the Master Page
into the <body><form> tag
and it worked...
lol, I spent hours googling around and found nothing.
I Hope if anybody`s got this noob (that`s me) problem, here is the solution.
Anyway, thanx Drew, and to everybody who wanted to help
![]() |
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Javscript framework
- Next Thread: Return value based upon visibility of form field?
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate array automatically beta box browser bug calendar captchaformproblem cart close codes column css cursor date debugger decimal dependent design disablefirebug dom download dropdown element embed engine enter error events ext file firefox focus form frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 iframe images index java javascript javascripthelp2020 jawascriptruntimeerror jquery jsp libcurl listbox maps masterpage media menu microsoft mimic mp4 onmouseoutdivproblem onmouseover paypal pdf php player position post problem programming prototype redirect regex safari scale scriptlets scroll search security select software sql text textarea unicode w3c website window windowofwords windowsxp





