I am trying to build a custom control to wrap my smart navigation
implimention (not microsofts 'cause it has problems)
The follow code works fine when the onclick and onload events are defined in
the Body tag. However, when I try to set them in Javascript code, I get
errors. What am I doing wrong???
**********THIS WORKS ************
<html>
<head>
<script>
function doOnClickBody() {
document.getEle mentById("hdnSc rollTop").value =
document.body.s crollTop;
}
function doOnLoadBody() {
document.body.s crollTop = document.getEle mentById("hdnSc rollTop").value ;
}
</script>
</head>
<body onClick="doOnCl ickBody();" onLoad="doOnLoa dBody();">
<form id="myFromId" runat="server">
<input type="hidden" id="hdnScrollTo p" runat="server" />
</form>
</body>
</html>
***********THIS DOES NOT WORK ***************
<script language="javas cript">
function doOnClickBody() {
document.getEle mentById("<%=Me .hdnScrollTop.C lientId%>").val ue =
document.body.s crollTop;
}
function doOnLoadBody() {
document.body.s crollTop =
document.getEle mentById("<%=Me .hdnScrollTop.C lientId%>").val ue;
}
document.body.o nclick = doOnClickBody() ; //CAUSES ERROR
document.body.o nload = doOnLoadBody(); //CAUSES ERROR
</script>
<body MS_POSITIONING= "FlowLayout " >
<form id="Form1" method="post" runat="server">
<input type="hidden" id="hdnScrollTo p" runat="server" NAME="hdnScroll Top">
</form>
</body> 2 4424
<script language="javas cript">
function doOnClickBody() {
//do something
}
function doOnLoadBody() {
//do something
}
document.onclic k = doOnClickBody;
window.onload =doOnLoadBody;
</script>
should work in both IE and mozilla.
Karl
"Earl Teigrob" <Ea*********@di scussions.micro soft.com> wrote in message
news:13******** *************** ***********@mic rosoft.com... I am trying to build a custom control to wrap my smart navigation implimention (not microsofts 'cause it has problems)
The follow code works fine when the onclick and onload events are defined
in the Body tag. However, when I try to set them in Javascript code, I get errors. What am I doing wrong???
**********THIS WORKS ************ <html> <head> <script> function doOnClickBody() { document.getEle mentById("hdnSc rollTop").value = document.body.s crollTop; }
function doOnLoadBody() { document.body.s crollTop = document.getEle mentById("hdnSc rollTop").value ; } </script> </head> <body onClick="doOnCl ickBody();" onLoad="doOnLoa dBody();">
<form id="myFromId" runat="server"> <input type="hidden" id="hdnScrollTo p" runat="server" /> </form> </body> </html>
***********THIS DOES NOT WORK ***************
<script language="javas cript"> function doOnClickBody() { document.getEle mentById("<%=Me .hdnScrollTop.C lientId%>").val ue = document.body.s crollTop; }
function doOnLoadBody() { document.body.s crollTop = document.getEle mentById("<%=Me .hdnScrollTop.C lientId%>").val ue; } document.body.o nclick = doOnClickBody() ; //CAUSES ERROR document.body.o nload = doOnLoadBody(); //CAUSES ERROR </script>
<body MS_POSITIONING= "FlowLayout " > <form id="Form1" method="post" runat="server"> <input type="hidden" id="hdnScrollTo p" runat="server" NAME="hdnScroll Top"> </form> </body>
This ended up being strictly a timing issue. Objects where not created or at
leasts finished being created when I was tring accessing them. Using the
window.setTimeo ut functionfixed all my problems...
Earl
"Karl" wrote: <script language="javas cript"> function doOnClickBody() { //do something }
function doOnLoadBody() { //do something } document.onclic k = doOnClickBody; window.onload =doOnLoadBody; </script>
should work in both IE and mozilla.
Karl
"Earl Teigrob" <Ea*********@di scussions.micro soft.com> wrote in message news:13******** *************** ***********@mic rosoft.com... I am trying to build a custom control to wrap my smart navigation implimention (not microsofts 'cause it has problems)
The follow code works fine when the onclick and onload events are defined in the Body tag. However, when I try to set them in Javascript code, I get errors. What am I doing wrong???
**********THIS WORKS ************ <html> <head> <script> function doOnClickBody() { document.getEle mentById("hdnSc rollTop").value = document.body.s crollTop; }
function doOnLoadBody() { document.body.s crollTop = document.getEle mentById("hdnSc rollTop").value ; } </script> </head> <body onClick="doOnCl ickBody();" onLoad="doOnLoa dBody();">
<form id="myFromId" runat="server"> <input type="hidden" id="hdnScrollTo p" runat="server" /> </form> </body> </html>
***********THIS DOES NOT WORK ***************
<script language="javas cript"> function doOnClickBody() { document.getEle mentById("<%=Me .hdnScrollTop.C lientId%>").val ue = document.body.s crollTop; }
function doOnLoadBody() { document.body.s crollTop = document.getEle mentById("<%=Me .hdnScrollTop.C lientId%>").val ue; } document.body.o nclick = doOnClickBody() ; //CAUSES ERROR document.body.o nload = doOnLoadBody(); //CAUSES ERROR </script>
<body MS_POSITIONING= "FlowLayout " > <form id="Form1" method="post" runat="server"> <input type="hidden" id="hdnScrollTo p" runat="server" NAME="hdnScroll Top"> </form> </body> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lasse |
last post by:
I have done this simple function, it seems to work as intended, to
solve a problem i have had for a while. I couldnt find any sample
around that was working for me.
I would like to test it with you and see if there are any improvments
that i should make ;-)
It should be fast and if possible compatible with todays modern
browser-standards. It...
|
by: David List |
last post by:
I'm having a problem using different properties of the document object
in the example javascripts in my textbook with browsers that identify
themselves as using the Mozilla engine. One example of these
problems is using document.layers. I have Google'd for examples of how
to use the document object specifically with Mozilla, but I cannot
find...
|
by: lawrence |
last post by:
I'm a beginner with Javascript and especially cross-browser
Javascript. I got this working in IE, but not in Netscape 7. It seems
like, in Netscape, every time I click on a button, the focus shifts to
that button, so there is no text to be selected. What should I do?
Below you'll see some code that I have in one of my forms. I was
hoping to...
|
by: kurt |
last post by:
greetings,
I'm working on a bookmarklet that needs to overwrite the current
document with a frameset where the src of one of the frames is the
current URL. What I've come up with works in Mozilla (Firefox 1.0pr).
But in IE6, though View Source shows that the new frameset is there
with the correct URL inserted, nothing displays. It's a white...
|
by: Eric Mitchell |
last post by:
Hello all,
I am using the document.write() method to create new content on the same
page, however... I need to create a new button using this method (button in
HTML). Complicating the matter worse, I have a javascript function that
needs to be called in the onClick event of the button. Is there any way of
doing this? Here is my code, which...
| |
by: Paul Thompson |
last post by:
I am working with a special tool which pre-processes the page. Using
document.write, I am composing the page while it is loading, so I need
to force a reprocess of the page AFTER the page loads.
Is there some way to do that? That is, I want the browser to
essentially act as if the composed page was the original page.
Here is a brief...
|
by: AC |
last post by:
I had a page that does some event setup on window.onload:
function prepEvents()
{
document.getElementById("menumap_sales").onmouseover =
swapMenuSales;
// etc
}
window.onload = prepEvents;
|
by: vunet |
last post by:
It is recommended by some sources I found to create IFrames in IE
using
document.createElement('<iframe src="#">')
instead of document.createElement('iframe').
Why and what browser versions to use it? IE5 or IE6?
Thanks
|
by: ankit1999 |
last post by:
I have a problem,
everytime i'm run this page
http://click2travel.in/index.php
i get the this error,,,
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |