473,597 Members | 2,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<body onload="alert(' Hello');"> does not work! Why?

Hi everyone,
Has someone out there experienced the same problem? What i wanted to do is
to display a popup window (modal) upon the loading of a webpage. Here is my
code sample (in html view):
<HTML>
<HEAD>
....
</HEAD>
<BODY onload="ShowPop Up();" MS_POSITIONING= "GridLayout ">
....
....
</BODY>
</HTML>
Where ShowPopUp() is a JavaScript function to display the popup window.
However it does not get called. When I replaced the function with just a
simple alert('Hello') function, still nothing is displayed at load up.
However, crazy enough, I got it to work on some of the pages though.?????
Is there anything that is missing or shouldn't be there?
Please help me...
Calvin
Nov 19 '05 #1
7 6206
Try using :-RegisterStartup Script Method

Check sample at:-
http://www.codeproject.com/aspnet/Mayank_Gupta.asp
or
http://www.aspnetpro.com/NewsletterA...200410bm_l.asp

http://msdn.microsoft.com/library/de...criptTopic.asp
Hope that helps
Patrick

"Calvin KD" <Ca******@discu ssions.microsof t.com> wrote in message
news:89******** *************** ***********@mic rosoft.com...
Hi everyone,
Has someone out there experienced the same problem? What i wanted to do is
to display a popup window (modal) upon the loading of a webpage. Here is my code sample (in html view):
<HTML>
<HEAD>
...
</HEAD>
<BODY onload="ShowPop Up();" MS_POSITIONING= "GridLayout ">
...
...
</BODY>
</HTML>
Where ShowPopUp() is a JavaScript function to display the popup window.
However it does not get called. When I replaced the function with just a
simple alert('Hello') function, still nothing is displayed at load up.
However, crazy enough, I got it to work on some of the pages though.?????
Is there anything that is missing or shouldn't be there?
Please help me...
Calvin

Nov 19 '05 #2
It looks ok. Do you have javascript enabled on that machine?

Eliyahu

"Calvin KD" <Ca******@discu ssions.microsof t.com> wrote in message
news:89******** *************** ***********@mic rosoft.com...
Hi everyone,
Has someone out there experienced the same problem? What i wanted to do is
to display a popup window (modal) upon the loading of a webpage. Here is my code sample (in html view):
<HTML>
<HEAD>
...
</HEAD>
<BODY onload="ShowPop Up();" MS_POSITIONING= "GridLayout ">
...
...
</BODY>
</HTML>
Where ShowPopUp() is a JavaScript function to display the popup window.
However it does not get called. When I replaced the function with just a
simple alert('Hello') function, still nothing is displayed at load up.
However, crazy enough, I got it to work on some of the pages though.?????
Is there anything that is missing or shouldn't be there?
Please help me...
Calvin

Nov 19 '05 #3
Where have you defined the JavaScript function? When you use the body
"onload" event to call a function, it must be declared in the head. The
RegisterStartup Script() method puts the JavaScript code that should run when
the page is loaded at the bottom of the form. This always works, as long as
there are no references in the script to HTML elements below the script in
the page. This is due to the fact that browsers don't always get all of the
HTML for the page in one swell foop.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Paranoia is just a state of mind.

"Calvin KD" <Ca******@discu ssions.microsof t.com> wrote in message
news:89******** *************** ***********@mic rosoft.com...
Hi everyone,
Has someone out there experienced the same problem? What i wanted to do is
to display a popup window (modal) upon the loading of a webpage. Here is
my
code sample (in html view):
<HTML>
<HEAD>
...
</HEAD>
<BODY onload="ShowPop Up();" MS_POSITIONING= "GridLayout ">
...
...
</BODY>
</HTML>
Where ShowPopUp() is a JavaScript function to display the popup window.
However it does not get called. When I replaced the function with just a
simple alert('Hello') function, still nothing is displayed at load up.
However, crazy enough, I got it to work on some of the pages though.?????
Is there anything that is missing or shouldn't be there?
Please help me...
Calvin

Nov 19 '05 #4
Thank you so much for all your responses.
My ShowPopUp() javascript function is declared in the header on the same
page as where it's called. What really puzzled me was even the
onload="alert(' Hello');" did not display the message at load up.
What I really want to do is showing the popup (modal) window, which is a
Search screen where the user selects a record. When the popup is closed, the
selected ID is returned back to the parent window, put the returned ID in a
hidden field then reload the page so that the rest of the details can be
displayed on the screen.
How easy is it to do this using the RegisterStartup Script facility?

Thanks again,
Calvin

"Calvin KD" wrote:
Hi everyone,
Has someone out there experienced the same problem? What i wanted to do is
to display a popup window (modal) upon the loading of a webpage. Here is my
code sample (in html view):
<HTML>
<HEAD>
...
</HEAD>
<BODY onload="ShowPop Up();" MS_POSITIONING= "GridLayout ">
...
...
</BODY>
</HTML>
Where ShowPopUp() is a JavaScript function to display the popup window.
However it does not get called. When I replaced the function with just a
simple alert('Hello') function, still nothing is displayed at load up.
However, crazy enough, I got it to work on some of the pages though.?????
Is there anything that is missing or shouldn't be there?
Please help me...
Calvin

Nov 19 '05 #5
Calvin.
I posted some sample links in my earlier post how you could use it.
If u still can't figure it out post your Js and will feed you back.
Patrick
"Calvin KD" <Ca******@discu ssions.microsof t.com> wrote in message
news:AE******** *************** ***********@mic rosoft.com...
Thank you so much for all your responses.
My ShowPopUp() javascript function is declared in the header on the same
page as where it's called. What really puzzled me was even the
onload="alert(' Hello');" did not display the message at load up.
What I really want to do is showing the popup (modal) window, which is a
Search screen where the user selects a record. When the popup is closed, the selected ID is returned back to the parent window, put the returned ID in a hidden field then reload the page so that the rest of the details can be
displayed on the screen.
How easy is it to do this using the RegisterStartup Script facility?

Thanks again,
Calvin

"Calvin KD" wrote:
Hi everyone,
Has someone out there experienced the same problem? What i wanted to do is to display a popup window (modal) upon the loading of a webpage. Here is my code sample (in html view):
<HTML>
<HEAD>
...
</HEAD>
<BODY onload="ShowPop Up();" MS_POSITIONING= "GridLayout ">
...
...
</BODY>
</HTML>
Where ShowPopUp() is a JavaScript function to display the popup window.
However it does not get called. When I replaced the function with just a
simple alert('Hello') function, still nothing is displayed at load up.
However, crazy enough, I got it to work on some of the pages though.????? Is there anything that is missing or shouldn't be there?
Please help me...
Calvin

Nov 19 '05 #6
Thanks so much Patrick. I think I have some ideas as how to do it and I will
give it a shot.
Would you be kind enough to check out this post again next week in case I
still have issues and may ask for your help?
Thanks again,
Calvin.

"Patrick.O. Ige" wrote:
Calvin.
I posted some sample links in my earlier post how you could use it.
If u still can't figure it out post your Js and will feed you back.
Patrick
"Calvin KD" <Ca******@discu ssions.microsof t.com> wrote in message
news:AE******** *************** ***********@mic rosoft.com...
Thank you so much for all your responses.
My ShowPopUp() javascript function is declared in the header on the same
page as where it's called. What really puzzled me was even the
onload="alert(' Hello');" did not display the message at load up.
What I really want to do is showing the popup (modal) window, which is a
Search screen where the user selects a record. When the popup is closed,

the
selected ID is returned back to the parent window, put the returned ID in

a
hidden field then reload the page so that the rest of the details can be
displayed on the screen.
How easy is it to do this using the RegisterStartup Script facility?

Thanks again,
Calvin

"Calvin KD" wrote:
Hi everyone,
Has someone out there experienced the same problem? What i wanted to do is to display a popup window (modal) upon the loading of a webpage. Here is my code sample (in html view):
<HTML>
<HEAD>
...
</HEAD>
<BODY onload="ShowPop Up();" MS_POSITIONING= "GridLayout ">
...
...
</BODY>
</HTML>
Where ShowPopUp() is a JavaScript function to display the popup window.
However it does not get called. When I replaced the function with just a
simple alert('Hello') function, still nothing is displayed at load up.
However, crazy enough, I got it to work on some of the pages though.????? Is there anything that is missing or shouldn't be there?
Please help me...
Calvin


Nov 19 '05 #7
Thanks so much Patrick. I have managed to get it to work base on your ideas.
So thanks again.
Cheers.
Calvin

"Patrick.O. Ige" wrote:
Calvin.
I posted some sample links in my earlier post how you could use it.
If u still can't figure it out post your Js and will feed you back.
Patrick
"Calvin KD" <Ca******@discu ssions.microsof t.com> wrote in message
news:AE******** *************** ***********@mic rosoft.com...
Thank you so much for all your responses.
My ShowPopUp() javascript function is declared in the header on the same
page as where it's called. What really puzzled me was even the
onload="alert(' Hello');" did not display the message at load up.
What I really want to do is showing the popup (modal) window, which is a
Search screen where the user selects a record. When the popup is closed,

the
selected ID is returned back to the parent window, put the returned ID in

a
hidden field then reload the page so that the rest of the details can be
displayed on the screen.
How easy is it to do this using the RegisterStartup Script facility?

Thanks again,
Calvin

"Calvin KD" wrote:
Hi everyone,
Has someone out there experienced the same problem? What i wanted to do is to display a popup window (modal) upon the loading of a webpage. Here is my code sample (in html view):
<HTML>
<HEAD>
...
</HEAD>
<BODY onload="ShowPop Up();" MS_POSITIONING= "GridLayout ">
...
...
</BODY>
</HTML>
Where ShowPopUp() is a JavaScript function to display the popup window.
However it does not get called. When I replaced the function with just a
simple alert('Hello') function, still nothing is displayed at load up.
However, crazy enough, I got it to work on some of the pages though.????? Is there anything that is missing or shouldn't be there?
Please help me...
Calvin


Nov 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6170
by: tilt | last post by:
Hello, I use an object element to replace the iframe element in ie, like this: <object id="x_obj" data="http://.../" type="text/html"> <iframe name="x_if" id="x_if" src="http://.../">
5
6479
by: Jason | last post by:
Hello, I am trying to dynamically create a table, then set its <td>'s onclick: var table = document.createElement("table"); var row = table.insertRow(-1); var td = row.insertCell(-1); td.onclick = myfunction; function myfunction(event) { alert(event);
5
13341
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL http://mghospedagem.com/images/controlpanel.jpg instead of http://mghospedagem.comhttp://mghospedagem.com/images/controlpanel.jpg As u see, there's the website URL before the image URL.
0
7965
marktang
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...
0
7885
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8380
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8258
tracyyun
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...
0
6686
agi2029
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...
1
5847
isladogs
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...
0
5426
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();...
0
3923
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1231
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.