Hi there!
I'm developing some crazy Tab Control in .NET that uses JavaScript.
A particular JavaScript method needs to be called during the window.onload event in order to initialize my Tab Control.
The thing is that there can be more than one Tab Control on the page....and each one must be initialized during the window.onload event.
Adding the JavaScript function call responsible for initializing a particular Tab Control to the function that the window.onload calls is impossible using .NET (I've tried to do this for 4 days now...) For Example:
This is not possible to do from a .NET standpoint: -
-
<script type="text/javascript">
-
<!--
-
window.onload = function() {
-
-
/*This Is Not Possible*/
-
eval(TabControl1_intializeTabbedControls());
-
eval(TabControl2_intializeTabbedControls());
-
eval(TabControl3_intializeTabbedControls());
-
/*.....................*/
-
}// -->
-
</script>
-
This is possible to do from a .NET standpoint but obviously won't work in javascript : -
<script type="text/javascript">
-
<!--window.onload = function() {eval(TabControl1_intializeTabbedControls());}//-->
-
</script>
-
-
<script type="text/javascript">
-
<!--window.onload = function() {eval(TabControl2_intializeTabbedControls());}//-->
-
</script>
-
-
<script type="text/javascript">
-
<!--window.onload = function() {eval(TabControl3_intializeTabbedControls());}//-->
-
</script>
-
Basically I'd like to call the window.onload more than once...but this isn't possible...so I'm open to any other suggestions...
Does anyone have any suggestions on how to do this?
Thanks for your time
-lilolme
5 9482 acoder 16,027
Recognized Expert Moderator MVP
Try using addEventListene r (W3C standard) and attachEvent (IE). See this article (the events part). Also see this link for an explanation.
PS. changed the thread title slightly.
Try using addEventListene r (W3C standard) and attachEvent (IE). See this article (the events part). Also see this link for an explanation.
PS. changed the thread title slightly.
Acoder, you're a lifesaver!!
Thank you so much for that quicksmode link!
You've helped me immensely!
Every thing's working well in browsers that are not IE :):)
IE will load the page properly ...except that for some reason I'm getting a " Type Mismatch" error. The line number that IE says the error occur on just contains a <tr>...and the vagueness of the error is not helping me at all. -
<script type="text/javascript">
-
<!--
-
if(window.attachEvent){
-
window.attachEvent("onload",TabControl1_intializeTabbedControls());
-
}else{
-
window.addEventListener("load",TabControl1_intializeTabbedControls(),false);
-
}
-
// -->
-
</script>
-
-
<script type="text/javascript">
-
<!--
-
if(window.attachEvent){
-
window.attachEvent("onload",TabControl2_intializeTabbedControls());
-
}else{
-
window.addEventListener("load",TabControl2_intializeTabbedControls(),false);
-
}
-
// -->
-
</script>
-
Do you have any insight as to why this might be occurring?
Thank you for being so patient with me :) JavaScript is not one of my strong points.
-LilOlMe
acoder 16,027
Recognized Expert Moderator MVP
Remove the parentheses when attaching/adding event listeners: -
if(window.attachEvent){
-
window.attachEvent("onload",TabControl1_intializeTabbedControls);
-
}else{
-
window.addEventListener("load",TabControl1_intializeTabbedControls,false);
-
}
If that doesn't work, show the code for the tab control function.
Remove the parentheses when attaching/adding event listeners: -
if(window.attachEvent){
-
window.attachEvent("onload",TabControl1_intializeTabbedControls);
-
}else{
-
window.addEventListener("load",TabControl1_intializeTabbedControls,false);
-
}
If that doesn't work, show the code for the tab control function.
Thanks Again!
I removed the () and everything works perfectly now :)
Wish I had asked my question earlier!
-LilOlMe
acoder 16,027
Recognized Expert Moderator MVP
Glad you got it working. Post again anytime should you hit some problem.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Da Costa Gomez |
last post by:
Hi all,
I've been eluded the last couple of *days* on the onload mystery within
the frame and function context.
Problem is as follows:
- frameset with two frames. One called scripts and the other called main
- scripts carries a bunch of js functions rechable via
parent.scripts.functioName()
- Main carries the html page that utilizes some functions
|
by: Disco-181 |
last post by:
Hi,
I have a script which isn't working in Mozilla based browser for some
reason. I'm trying to run two functions from the body onload tag and
it simply isn't happening.
I have a cascading menu, where the primary dropdown selection
determines the contents of a second dropdown. This is triggered by a
function in the onchange tag of the primarys select tag. When
triggered like this, the function and drop downs work fine. When
|
by: John J. Lee |
last post by:
I was cheered to see that this guy claims to have solved the problem
with onload only firing very late:
http://dean.edwards.name/weblog/2005/09/busted/
However, "ash" comments on that page:
|
by: Matt Ratliff |
last post by:
Hello,
I would appreciate any assistance you have with the following
problem:
I have (as an example) an array of values as follows:
arrayvalues=new Array("0001","0003","0005") where each is the value
of an option in a select statement:
<select id="usertypes" multiple="multiple">
<option value="0033">data1</option>
|
by: Lorenzo Thurman |
last post by:
Is there a shorthand way to assign the same actions to multiple handlers
? I know I can just just do:
onBlur='myFunction()';onClick='myFunction()'
I'm just looking to save some keystrokes. I actually have this issue now
and it involves a couple of functions with long parameter lists.
TIA
| |
by: steve.chambers |
last post by:
I'm sure this q must have been asked before but I'm really struggling
to find the answer anywhere so have finally given up and will consult
the usenet community - hopefully there's someone out there who's seen
it all before and can help me out! I have a webpage which needs to
make some function calls after the page has loaded - won't go into
details surfice to say here is a code fragment:
function addLoadEvent(func) {
var oldonload =...
|
by: Michael Landberg |
last post by:
Hi
is it possible to load multiple onload events in the body tag?
Regards
|
by: zepdad |
last post by:
I'm new to forum and am learning javascript. I appreciate your help and patience in advance. I run an image gallery website that uses an onload event called FitPic() to scale image and window sizes to fit the users monitor resolution. FitPic() creates certain variables that would be useful for other calculations, such as reporting the % of image scaling. However, since onload events occur last during rendering, the variables are not...
|
by: Calm_Pear |
last post by:
Hi all,
I have created an object with a default function; the default function
exposes a public function as well.
myobject = function(){
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |