473,503 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem Loading Page in Specific Div

1 New Member
Main.html
=========
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head><title>Main Page</title></head>
  3. <script type="text/javascript" src=GetPage.js>
  4. </script>
  5. <body>
  6. <form method=get onsubmit="load('History.html','GetDiv'); return false;">
  7. <input type="text" name="quota" value="">
  8. </form>
  9.  
  10. <div id="GetDiv">
  11.  
  12. </div>
  13. </body>
  14. </html>


GetPage.js
===========
Expand|Select|Wrap|Line Numbers
  1. function ahah(url,target) {
  2.     document.getElementById(target).innerHTML = 'loading data...';
  3.     if (window.XMLHttpRequest) {
  4.         req = new XMLHttpRequest();
  5.         req.onreadystatechange = function() {ahahDone(target);};
  6.         req.open("GET", url, true);
  7.         req.send(null);
  8.     } else if (window.ActiveXObject) {
  9.         req = new ActiveXObject("Microsoft.XMLHTTP");
  10.         if (req) {
  11.             req.onreadystatechange = function() {ahahDone(target);};
  12.             req.open("GET", url, true);
  13.             req.send();
  14.         }
  15.     }
  16.  
  17.  
  18. function ahahDone(target) {
  19.    // only if req is "loaded"
  20.    if (req.readyState == 4) {
  21.        // only if "OK"
  22.        if (req.status == 200 || req.status == 304) {
  23.            results = req.responseText;
  24.            document.getElementById(target).innerHTML = results;
  25.        } else {
  26.            document.getElementById(target).innerHTML="ahah error:\n" +
  27.                req.statusText;
  28.        }
  29.    }
  30. }
  31.  
  32.  
  33. function load(name,div) {
  34.  
  35. ahah(name,div);
  36. return false;
  37.  
  38. }

History.html
=============
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head><title>History Page</title></head>
  3. <body>
  4. <div id="History">
  5. <p> History Page </p>
  6. <SCRIPT language="javascript">
  7. document.write("History Page");
  8. </SCRIPT>
  9. </div>
  10. </body>
  11. </html>

The Script works great. i am able to get the History.HTML Loaded perfectly under Div=GetDiv but i am unable to execute or run the Script under history.html page when its loaded under div.

Script on history.html page works well if opened in a new browser i.e. http://localhost/history.html

My main idea is to execute the script under history page and display it under GetDiv

Please Help !!!
Aug 28 '10 #1
0 993

Sign in to post your reply or Sign up for a free account.

Similar topics

6
3660
by: Mark Cunningham | last post by:
I am curious if there is something that would be considered a proper method for locating small (three to four items) amounts of page specific styling. Or does it really matter in the great scheme...
5
12281
by: 1337.geek | last post by:
I have a webpage, lots of javascript that i pulled from various places, the menu script pre-loads about 50 small images, it only takes about 5 seconds for broadband but for lower band connections i...
1
1377
by: Tom Vukovich | last post by:
I'm having a problem loading an xmldocument from the web. The xml i wish to bring into the application is generated from a request to an ASP page. The following code does not work. ...
2
79919
by: Saint's Knight | last post by:
make progress bar while browser is loading page. ang when finish loading , show the page
4
52493
dmjpro
by: dmjpro | last post by:
i want to stop loading page after loading starts ... using js how can i do it thanx in advance
1
1373
by: Christopera | last post by:
So i put a php based email submit form on my website http://www.chrislivengood.net. I bought the license for some code from a company and have good success with it thus far. However, on this site I...
1
1377
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hello misters and miss, I have an application web in asp.net 2.0. I have an Main.aspx page that include javascript code like this: window.location.href = 'anotherpage.aspx'; I want do this:...
1
1422
Ajm113
by: Ajm113 | last post by:
How can I create that popup bar that displays "Loading Page" on it. That displays on top of the website. Then close out when page is finished loading? Just like the one on Simple Machines Forum's?
3
1206
by: vingomail | last post by:
Loading pages should be showed before the next page data are loaded. help me friends. How may i know calculate the next page controls are loaded? Is there any methods to find out this problem? ...
0
7074
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...
1
6982
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...
0
7451
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...
1
5000
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...
0
4667
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...
0
3161
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...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
374
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...

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.