473,440 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,440 software developers and data experts.

Load a full page with scripts and style sheets using Ajax

I'm beginner in Ajax I'm creating a web site.It have many pages with scripts and style sheets.
But I wish to use same banner and navigation bar and other common features for all pages. (frame of my web site).So I wish to use ajax technology to load sub pages without reloading frame.
I know about placing a page on <div> tag with response text method.
But it doesn't load any scripts which are place on sub pages.
Can you help to load pages with scripts and style sheets?

my testing document is here:
Download
Jan 1 '08 #1
3 2368
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

To include scripts, add a script element and change its src property, e.g.
Expand|Select|Wrap|Line Numbers
  1. var script = document.createElement("script");
  2. script.src = theSourceToTheJavaScriptFile;
  3. document.getElementsByTagName("head")[0].appendChild(script);
and similarly for the style sheets using the link element.

I've changed the thread title to include scripts and stylesheets.
Jan 1 '08 #2
thank you very much acoder

in main page i have another problem.
again my testing document is here:

Download

don't forget I'm beginner

I'm going to load menu2.html in index.html but there are tow javascript code in menu2.html
i can load first part but the last part is
<script type="text/javascript" language="JavaScript">initProdMenus();</script>
then i think It should run with menu2.html

everybody can help me to complate this file?

please upload the final result
Jan 2 '08 #3
acoder
16,027 Expert Mod 8TB
I'm going to load menu2.html in index.html but there are tow javascript code in menu2.html
i can load first part but the last part is
<script type="text/javascript" language="JavaScript">initProdMenus();</script>
then i think It should run with menu2.html
Move that into the JavaScript file for an easy solution. If that is not possible, use document.createTextNode and append it to the script:
Expand|Select|Wrap|Line Numbers
  1. var text = document.createTextNode(jsString); // here would be "initProdMenus();"
  2. script.appendChild(text);
Jan 2 '08 #4

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

Similar topics

3
by: Rob Nicholson | last post by:
This is a question about the following KB article: http://support.microsoft.com/kb/q262161 We've got a problem with the Infragistics NetAdvantage presentation controls which they've suggested...
7
by: petr pilsl | last post by:
sorry - no idea where to post my question, so I crossposted to a linux and a html-authoring-group. Both groups might be familiar with wget. wget -p http://www.goldfisch.at does not load the...
1
by: mscertified | last post by:
Can anyone explain how references to style sheets work, I've exhausted looking in help, its all so confusing. I have three style sheets in my project under 'Style Sheets'. Only the first style...
1
by: jianxin9 | last post by:
Hi, I have an ajax powered tabs box that has a javascript drop-down search menu in the first tab. When I click on another tab, and go back to the first tab I have to refresh the page to get the...
1
by: charlie imac | last post by:
I have a question on the capability of Ajax. My question is: Is it possible to dynamically load any of the javascript gallery programs such as: Adobe Spry Gallery SmoothGallery others I...
4
daJunkCollector
by: daJunkCollector | last post by:
I am using AJAX to dynamically load content into a <div> layer. As it stands, I am loading .html's into the <div> layer and it works awesome. The problem is that when I try to replace the .html...
1
by: vjayis | last post by:
Hi I hav a page in which datas are displayed intially from the database. And using a link i m retriving datas from another page using ajax., it takes time and user might think tht nothing...
4
by: Nicolas R | last post by:
Hi all, Im trying to figure out how to display a 'loading' message when scripts are being executed, ie when the page is still not ready for interaction. This is for a web app which relies on...
4
hemantbasva
by: hemantbasva | last post by:
We have designed an aspx page having five ajax tab in it. the data of first four are designed on page whereas for the fifth tab it renders a user control named MYDOMAIN. in the tab container's even...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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,...
0
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...
1
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
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...
0
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,...
0
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
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...

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.