473,398 Members | 2,404 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,398 software developers and data experts.

script on page

I load some page using XMLHttpRequest. It has some java script on it. I add
this page (using innerHtml) to another but then the java script doesn't run.

The main page has

<script>
function go()
{
getElementById("replaceContent").innerHtml=httpReq .text;
}
</script>

<div id="replaceContent"> </div>

this is the page which I load in the background
<script>
alert("form request");
</script>

How to make the script from added innerHtml to run.

Patryk
Aug 29 '05 #1
5 1455
alu

"P4tryk" <p4****@patryk.pl> wrote
<script>
function go()
{
getElementById("replaceContent").innerHtml=httpReq .text;
}
</script> How to make the script from added innerHtml to run.

innerHTML is case sensitive, and getElementById is a method of the document
object.

The correct syntax would be:

document.getElementById("replaceContent").innerHTM L=httpReq.text;

-alu
Aug 29 '05 #2
ASM
P4tryk wrote:
I load some page using XMLHttpRequest. It has some java script on it. I add
this page (using innerHtml) to another but then the java script doesn't run.
innerHTML

and not

innerHtml
<script>
function go()
{
getElementById("replaceContent").innerHtml=httpReq .text;
}
</script>


--
Stephane Moriaux et son [moins] vieux Mac
Aug 30 '05 #3
Użytkownik "alu" <no**@none.com> napisał w wiadomo¶ci
news:jh*******************@news20.bellglobal.com.. .
innerHTML is case sensitive, and getElementById is a method of the
document
object.


ok, but how to make the script from the loaded page to run.
Patryk
Aug 30 '05 #4
alu
> "P4tryk" <p4****@patryk.pl> wrote

<script>
function go()
{
getElementById("replaceContent").innerHtml=httpReq .text;
}
</script>

How to make the script from added innerHtml to run.


_______________________________________________
innerHTML is case sensitive, and getElementById is a
method of the document object.
The correct syntax would be: document.getElementById("replaceContent").innerHTM L=httpReq.text;
-alu

_______________________________________________
ok, but how to make the script from the loaded page to run.
Patryk

_______________________________________________

You are using XMLHttpRequest to load an alert? You may be trying to kill a
mosquito with a sledgehammer here....
I can't say I understand the structure of your page(s), or the purpose of
loading the alert in the background(?).
You are asking how to make the script from the loaded page run - all I can
think of is that you are asking how to call the function itself, perhaps?
If this is the case, just call the function as below:

<script>
function go()
{
document.getElementById("replaceContent").innerHTM L=httpReq.text;
}
</script>

<div id="replaceContent"> </div>
<script>
alert("form request");
</script>

// somewhere in an appropriate place then, you would actually call the
function...

go();
Hope this solves the problem, if not, please explain clearly what you are
trying to achieve.
-alu
Aug 30 '05 #5
Użytkownik "alu" <no**@none.com> napisał w wiadomo¶ci
news:sa*******************@news20.bellglobal.com.. .
Hope this solves the problem, if not, please explain clearly what you are
trying to achieve.


This was an simple example I don't want to load alert from XMLHttpRequest.

I use telerik menu control, you can build nice context menus for .net.
The problem is that I can only build the menu on server side, but I need to
show different context menu every time the user clicks an element and I
can't refresh the page.
The scenario is
-user cliks
-xmlReq to server
-the server builds menu
-I attach the menu from using innerHtml

The only problem is that I need to run js from the laded page. The js is
between <scritp> </script> there is no function I can call. The js is needed
to attach the events and do some other things that I dont't know and it's
different every time.

Patryk



Aug 31 '05 #6

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

Similar topics

8
by: Sticks | last post by:
ok... im not quite sure how to describe my problem. i have a php script that runs through my entire php site and writes the resulting output to html files. this is necessary as the nature of the...
6
by: Mike Daniel | last post by:
I am attempting to use document.write(pageVar) that displays a new html page within a pop-up window and the popup is failing. Also note that pageVar is a complete HTML page containing other java...
3
by: Ed Brandmark | last post by:
I have a tag of the form <SCRIPT LANGUAGE="JavaScript1.1" SRC="foo.js"..... and was wondering if this delays the loading of my page until that file foo.js downloads. It seems that if I place...
4
by: Christopher Benson-Manica | last post by:
Obviously, compiliant browsers that encounter <script type="text/javascript"> <!-- // your script here // --> </script> will either execute the script or ignore it completely. However, we...
1
by: ebrandmark | last post by:
I am trying to load a SCRIPT SRC tag that will result in a document.write into a specific location in my web page but not call for the SCRIPT SRC until the end of the page (so as not to delay the...
13
by: nobody | last post by:
Hello all, I've searched just about everything and although I can see that other people are having problems, but theirs don't seem to relate, so in a last ditch attempt, my posting! Script...
4
by: Russ | last post by:
I have a form page with a submit button. When the submit is successfull (good return from web service), I insert a script to put up a message box saying "Form submitted". That works fine, but...
17
by: PJ | last post by:
Greetings... I have stumbled upon a small problem. I use Ajax to retrieve part of a page I need to update. I update a DIV element with the HTML contents I get from another page. It works...
1
by: Larry Rebich | last post by:
I'm using some Java Script I found that supports a 'back' button on my ASP.Net page. The Asp.Net page uses a Master page. I thought I'd put the Java Script in a Java Script file . The thought was...
7
by: imtmub | last post by:
I have a page, Head tag Contains many Scripts and style sheet for Menu and Page. This code working fine and displaying menus and page as i wanted. Check this page for reference....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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...
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...

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.