473,667 Members | 2,548 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

question about javascript

Hello everybody

In a webpage, I use JS display data from an xml file and a xsl file:

var data = new ActiveXObject(" Microsoft.XMLDO M");
data.async = false;
var dataUrl = "data.aspx" ;
data.load(dataU rl) ;
var transform = new ActiveXObject(" Microsoft.XMLDO M");
transform.async = false ;
transform.load( "discussion.xsl t");

result.innerHTM L = data.transformN ode(transform);

result is a div.

Somewhere in my xsl file I have a script that is repeated many times:

<xsl:for-each select="m:Messa ges">
....sometext...
<script language="javas cript">
alert('<xsl:val ue-of select="m:Messa geID" />');
</script>
</xsl:for-each>

My problem is that the Javascript (alert) is not fired. I don't think the
problem is from my xsl file since the "sometext"actua lly appears in the
page.

I wonder, if Javascript rendered on the fly is executed. If it is, how can I
do a "execute scripts" or anything like this ?

Thanks !

Steve
Nov 18 '05 #1
6 1568
"Steve B." <n.************ *@airsoftconsul ting.com> wrote in message
news:uh******** *****@TK2MSFTNG P09.phx.gbl...
Hello everybody

In a webpage, I use JS display data from an xml file and a xsl file:

var data = new ActiveXObject(" Microsoft.XMLDO M");
data.async = false;
var dataUrl = "data.aspx" ;
data.load(dataU rl) ;
var transform = new ActiveXObject(" Microsoft.XMLDO M");
transform.async = false ;
transform.load( "discussion.xsl t");

result.innerHTM L = data.transformN ode(transform);

result is a div.

Somewhere in my xsl file I have a script that is repeated many times:

<xsl:for-each select="m:Messa ges">
...sometext...
<script language="javas cript">
alert('<xsl:val ue-of select="m:Messa geID" />');
</script>
</xsl:for-each>

My problem is that the Javascript (alert) is not fired. I don't think the
problem is from my xsl file since the "sometext"actua lly appears in the
page.

I wonder, if Javascript rendered on the fly is executed. If it is, how can I do a "execute scripts" or anything like this ?

Thanks !

Steve

I think the problem is that when loading initially inline script is
recognised and run, not when added as innerHTML. Although this is an
untested hypothesis you may need to start the alert boxes yourself. Can you
post a small sample of your source and what you want to be alerted?

--

Joe (MVP - xml)
Nov 18 '05 #2
I'm tring to build a little chat in asp.net.
Since postbacks are awfull for such scenarios, I want to downloads messages
and transforms them in html form, instead of reloading the whole page.

The asp.net codebehind only generates a xml file from a dataset (that's why
my data xml file is a .aspx page).
Here is my current version (I removed useless lines for easyier read)
----------------------------------------------------------------------------
-
default.aspx:
__________

<HTML>
<HEAD>
<title>defaul t</title>
<script language="javas cript">
<!--
function DoTransform()
{
var data = new ActiveXObject(" Microsoft.XMLDO M");
data.async = false;
var dataUrl = "data.aspx" ;
var last = document.getEle mentById("last" );
data.load(dataU rl) ;

var transform = new ActiveXObject(" Microsoft.XMLDO M");
transform.async = false ;
transform.load( "discussion.xsl t");

result.innerHTM L = data.transformN ode(transform);
}

// -->
</script>
</HEAD>
<body MS_POSITIONING= "FlowLayout ">
<form id="Form1" method="post" runat="server">
<asp:TextBox id="TextBox1" runat="server"
EnableViewState ="False"></asp:TextBox>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button>

<div id="result">
</div>

<script language="javas cript">
<!--
DoTransform();
// -->
</script>
</form>
</body>
</HTML>
----------------------------------------------------------------------------
-
data.aspx (result sent to the client using dataset.writexm l):
----------------------------------------------------------------------------
-
<?xml version="1.0" standalone="yes "?>
<MessagesDataSe t xmlns="http://www.tempuri.org/MessagesDataSet .xsd">
<Messages>
<MessageID>9</MessageID>
<Author>steve </Author>
<Body>Bonjour </Body>
<TimeStamp>20 04-08-11T16:46:52.215 0393+02:00</TimeStamp>
</Messages>
............... ............... ........
............... ............... ........
</MessagesDataSet >
----------------------------------------------------------------------------
-
and my xslt file
----------------------------------------------------------------------------
-
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:m="http://www.tempuri.org/MessagesDataSet .xsd">
<xsl:template match="/m:MessagesDataS et">
<table border="1">
<tr>
<td>auto</td>
<td>body</td>
</tr>
<xsl:apply-templates />
</table>
<xsl:for-each select="m:Messa ges">
<script language="javas cript">
alert('<xsl:val ue-of select="m:Messa geID" />');
</script>
</xsl:for-each>
</xsl:template>
<xsl:template match="m:Messag es">
<tr>
<td>
<b>
<xsl:call-template name="format-date">
<xsl:with-param name="date" select="m:TimeS tamp" />
</xsl:call-template>
</b>
<xsl:value-of select="m:Autho r" />
</td>
<td>
<xsl:value-of select="m:Body" />
</td>
</tr>
</xsl:template>
<xsl:template name="format-date">
<xsl:param name="date">
<xsl:value-of select="." />
</xsl:param>
<xsl:variable name="YYYY" select='substri ng($date, 1, 4)' />
<xsl:variable name="YY" select='substri ng($date, 3, 2)' />
<xsl:variable name="MM" select='substri ng($date, 6, 2)' />
<xsl:variable name="hh" select='substri ng($date, 12, 2)' />
<xsl:variable name="mm" select='substri ng($date, 15, 2)' />
<xsl:variable name="ss" select='substri ng($date, 18, 2)' />
<xsl:value-of select="concat( $hh, ':', $mm)" />
</xsl:template>
<xsl:template match="*" />
</xsl:stylesheet>
----------------------------------------------------------------------------
-
I do not want to keep the "alert" method, it was just for testing (it should
call another metod) if the JS is launched.
Thanks,
Steve

"Joe Fawcett" <jo********@hot mail.com> a écrit dans le message de news:
Oq************* *@TK2MSFTNGP11. phx.gbl...
"Steve B." <n.************ *@airsoftconsul ting.com> wrote in message
news:uh******** *****@TK2MSFTNG P09.phx.gbl...
Hello everybody

In a webpage, I use JS display data from an xml file and a xsl file:

var data = new ActiveXObject(" Microsoft.XMLDO M");
data.async = false;
var dataUrl = "data.aspx" ;
data.load(dataU rl) ;
var transform = new ActiveXObject(" Microsoft.XMLDO M");
transform.async = false ;
transform.load( "discussion.xsl t");

result.innerHTM L = data.transformN ode(transform);

result is a div.

Somewhere in my xsl file I have a script that is repeated many times:

<xsl:for-each select="m:Messa ges">
...sometext...
<script language="javas cript">
alert('<xsl:val ue-of select="m:Messa geID" />');
</script>
</xsl:for-each>

My problem is that the Javascript (alert) is not fired. I don't think the problem is from my xsl file since the "sometext"actua lly appears in the
page.

I wonder, if Javascript rendered on the fly is executed. If it is, how
can I
do a "execute scripts" or anything like this ?

Thanks !

Steve

I think the problem is that when loading initially inline script is
recognised and run, not when added as innerHTML. Although this is an
untested hypothesis you may need to start the alert boxes yourself. Can

you post a small sample of your source and what you want to be alerted?

--

Joe (MVP - xml)

Nov 18 '05 #3
"Steve B." <n.************ *@airsoftconsul ting.com> wrote in message
news:OU******** *****@TK2MSFTNG P12.phx.gbl...
I'm tring to build a little chat in asp.net.
Since postbacks are awfull for such scenarios, I want to downloads messages and transforms them in html form, instead of reloading the whole page.

The asp.net codebehind only generates a xml file from a dataset (that's why my data xml file is a .aspx page).
Here is my current version (I removed useless lines for easyier read)
-------------------------------------------------------------------------- -- -
default.aspx:
__________

<HTML>
<HEAD>
<title>defaul t</title>
<script language="javas cript">
<!--
function DoTransform()
{
var data = new ActiveXObject(" Microsoft.XMLDO M");
data.async = false;
var dataUrl = "data.aspx" ;
var last = document.getEle mentById("last" );
data.load(dataU rl) ;

var transform = new ActiveXObject(" Microsoft.XMLDO M");
transform.async = false ;
transform.load( "discussion.xsl t");

result.innerHTM L = data.transformN ode(transform);
}

// -->
</script>
</HEAD>
<body MS_POSITIONING= "FlowLayout ">
<form id="Form1" method="post" runat="server">
<asp:TextBox id="TextBox1" runat="server"
EnableViewState ="False"></asp:TextBox>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button>

<div id="result">
</div>

<script language="javas cript">
<!--
DoTransform();
// -->
</script>
</form>
</body>
</HTML>
-------------------------------------------------------------------------- -- -
data.aspx (result sent to the client using dataset.writexm l):
-------------------------------------------------------------------------- -- -
<?xml version="1.0" standalone="yes "?>
<MessagesDataSe t xmlns="http://www.tempuri.org/MessagesDataSet .xsd">
<Messages>
<MessageID>9</MessageID>
<Author>steve </Author>
<Body>Bonjour </Body>
<TimeStamp>20 04-08-11T16:46:52.215 0393+02:00</TimeStamp>
</Messages>
............... ............... .......
............... ............... .......
</MessagesDataSet >
-------------------------------------------------------------------------- -- -
and my xslt file
-------------------------------------------------------------------------- -- -
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:m="http://www.tempuri.org/MessagesDataSet .xsd">
<xsl:template match="/m:MessagesDataS et">
<table border="1">
<tr>
<td>auto</td>
<td>body</td>
</tr>
<xsl:apply-templates />
</table>
<xsl:for-each select="m:Messa ges">
<script language="javas cript">
alert('<xsl:val ue-of select="m:Messa geID" />');
</script>
</xsl:for-each>
</xsl:template>
<xsl:template match="m:Messag es">
<tr>
<td>
<b>
<xsl:call-template name="format-date">
<xsl:with-param name="date" select="m:TimeS tamp" />
</xsl:call-template>
</b>
<xsl:value-of select="m:Autho r" />
</td>
<td>
<xsl:value-of select="m:Body" />
</td>
</tr>
</xsl:template>
<xsl:template name="format-date">
<xsl:param name="date">
<xsl:value-of select="." />
</xsl:param>
<xsl:variable name="YYYY" select='substri ng($date, 1, 4)' />
<xsl:variable name="YY" select='substri ng($date, 3, 2)' />
<xsl:variable name="MM" select='substri ng($date, 6, 2)' />
<xsl:variable name="hh" select='substri ng($date, 12, 2)' />
<xsl:variable name="mm" select='substri ng($date, 15, 2)' />
<xsl:variable name="ss" select='substri ng($date, 18, 2)' />
<xsl:value-of select="concat( $hh, ':', $mm)" />
</xsl:template>
<xsl:template match="*" />
</xsl:stylesheet>
-------------------------------------------------------------------------- -- -
I do not want to keep the "alert" method, it was just for testing (it should call another metod) if the JS is launched.
Thanks,
Steve


Well you could try Martin's suggestion of adding the defer attribute but I
don't think this is intended for this purpose, why not call the method
manually after doing the transform:

DoTransform()
DoOtherMethod()

--

Joe
Nov 18 '05 #4
I need to set some variable using the script that is generated...

That's why calling another method is not possible.

The other way could be to generate <input type="hidden" id="field_N"
value="myValue" > and to use documet.getElem entById and a while...

Thanks,
Steve
"Joe Fawcett" <jo********@hot mail.com> a écrit dans le message de news:
e9************* *@tk2msftngp13. phx.gbl...
"Steve B." <n.************ *@airsoftconsul ting.com> wrote in message
news:OU******** *****@TK2MSFTNG P12.phx.gbl...
I'm tring to build a little chat in asp.net.
Since postbacks are awfull for such scenarios, I want to downloads

messages
and transforms them in html form, instead of reloading the whole page.

The asp.net codebehind only generates a xml file from a dataset (that's

why
my data xml file is a .aspx page).
Here is my current version (I removed useless lines for easyier read)


--------------------------------------------------------------------------
--
-
default.aspx:
__________

<HTML>
<HEAD>
<title>defaul t</title>
<script language="javas cript">
<!--
function DoTransform()
{
var data = new ActiveXObject(" Microsoft.XMLDO M");
data.async = false;
var dataUrl = "data.aspx" ;
var last = document.getEle mentById("last" );
data.load(dataU rl) ;

var transform = new ActiveXObject(" Microsoft.XMLDO M");
transform.async = false ;
transform.load( "discussion.xsl t");

result.innerHTM L = data.transformN ode(transform);
}

// -->
</script>
</HEAD>
<body MS_POSITIONING= "FlowLayout ">
<form id="Form1" method="post" runat="server">
<asp:TextBox id="TextBox1" runat="server"
EnableViewState ="False"></asp:TextBox>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button>

<div id="result">
</div>

<script language="javas cript">
<!--
DoTransform();
// -->
</script>
</form>
</body>
</HTML>


--------------------------------------------------------------------------
--
-
data.aspx (result sent to the client using dataset.writexm l):


--------------------------------------------------------------------------
--
-
<?xml version="1.0" standalone="yes "?>
<MessagesDataSe t xmlns="http://www.tempuri.org/MessagesDataSet .xsd">
<Messages>
<MessageID>9</MessageID>
<Author>steve </Author>
<Body>Bonjour </Body>
<TimeStamp>20 04-08-11T16:46:52.215 0393+02:00</TimeStamp>
</Messages>
............... ............... .......
............... ............... .......
</MessagesDataSet >


--------------------------------------------------------------------------
--
-
and my xslt file


--------------------------------------------------------------------------
--
-
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:m="http://www.tempuri.org/MessagesDataSet .xsd">
<xsl:template match="/m:MessagesDataS et">
<table border="1">
<tr>
<td>auto</td>
<td>body</td>
</tr>
<xsl:apply-templates />
</table>
<xsl:for-each select="m:Messa ges">
<script language="javas cript">
alert('<xsl:val ue-of select="m:Messa geID" />');
</script>
</xsl:for-each>
</xsl:template>
<xsl:template match="m:Messag es">
<tr>
<td>
<b>
<xsl:call-template name="format-date">
<xsl:with-param name="date" select="m:TimeS tamp" />
</xsl:call-template>
</b>
<xsl:value-of select="m:Autho r" />
</td>
<td>
<xsl:value-of select="m:Body" />
</td>
</tr>
</xsl:template>
<xsl:template name="format-date">
<xsl:param name="date">
<xsl:value-of select="." />
</xsl:param>
<xsl:variable name="YYYY" select='substri ng($date, 1, 4)' />
<xsl:variable name="YY" select='substri ng($date, 3, 2)' />
<xsl:variable name="MM" select='substri ng($date, 6, 2)' />
<xsl:variable name="hh" select='substri ng($date, 12, 2)' />
<xsl:variable name="mm" select='substri ng($date, 15, 2)' />
<xsl:variable name="ss" select='substri ng($date, 18, 2)' />
<xsl:value-of select="concat( $hh, ':', $mm)" />
</xsl:template>
<xsl:template match="*" />
</xsl:stylesheet>


--------------------------------------------------------------------------
--
-
I do not want to keep the "alert" method, it was just for testing (it

should
call another metod) if the JS is launched.
Thanks,
Steve


Well you could try Martin's suggestion of adding the defer attribute but I
don't think this is intended for this purpose, why not call the method
manually after doing the transform:

DoTransform()
DoOtherMethod()

--

Joe

Nov 18 '05 #5
Not sure if these will help but here's what I've done ...

1. You can fire an event by - oHint.fireEvent ("onclick");

2. Or the problem could be in innerHTML

My kickoof page looks like this:

<%@ LANGUAGE = Jscript %>
<%

var pageid = Request.QuerySt ring("id") + "";
var courseid = Request.QuerySt ring("course") + "";
var learnerIP = Request.ServerV ariables("REMOT E_ADDR") + "";
var themeID = Request.QuerySt ring("theme") + "";

if (Request.QueryS tring("snd").Co unt ==0) {
var withSound = 1;
}else{
var withSound = Request.QuerySt ring("snd") + "";
}

var coursename = courseid + ".xml"
var sourcefile = Server.MapPath( coursename);
var stylefile = Server.MapPath( "GPxml.xsl" );

var xmlDoc = new ActiveXObject(" MSXML2.FreeThre adedDOMDocument .3.0");
var xslSheet = new ActiveXObject(" MSXML2.FreeThre adedDOMDocument .3.0");
var xslTemplate = new ActiveXObject(" MSXML2.XSLTempl ate.3.0");
xmlDoc.async = false;
xmlDoc.load(sou rcefile);

//Check for a successful load of the XML Document.

xslSheet.load(s tylefile);
xslSheet.async = false;
xslTemplate.sty lesheet = xslSheet;
var xslProcessor = xslTemplate.cre ateProcessor();
xslProcessor.in put = xmlDoc;

//Check for hi-contrast theme
var bgColor
if (themeID == 2) {
bgColor = "FFFFFF";
}else{
bgColor = "FFFFEE";
}

//see if we passed a theme to override the default course one
if (themeID > 0) {
themeID = "Theme" + themeID;
}else{
themeID = "Theme1"
}
xslProcessor.ad dParameter("id" , pageid);
xslProcessor.ad dParameter("cou rse", courseid);
xslProcessor.ad dParameter("ip" , learnerIP);
xslProcessor.ad dParameter("the meID", themeID);
xslProcessor.ad dParameter("bgC olorID", bgColor);
xslProcessor.ad dParameter("wit hSound", withSound);

xslProcessor.tr ansform();
Response.Write( xslProcessor.ou tput);

--------------------
and in the XSLT:

<xsl:variable name="Exception " select="concat( 'EXCEPTION(S): ', .)"/>

<div id="sndExceptio ns"
onactivate="doc ument.oExceptio n.src='{$imgExc eptionFocus}'"
ondeactivate="d ocument.oExcept ion.src='{$imgE xception}'"
onClick="javasc ript:alert('{$E xception}');" >

.... div content ...

</div>
---------------------

3. The DEFER is a good idea see this example if within the XSLT file ...

<!--*************** ****TEST DISPLAY******** ************-->
<!--Use of DEFER forces client side processing-->
<SCRIPT LANGUAGE="javas cript" DEFER="true">
<xsl:comment>
<![CDATA[

function msgTest() {
alert("TEST");
}
]]>
</xsl:comment>
</SCRIPT>
Hope it helps.
ed
"Steve B." <n.************ *@airsoftconsul ting.com> wrote in message
news:uh******** *****@TK2MSFTNG P09.phx.gbl...
Hello everybody

In a webpage, I use JS display data from an xml file and a xsl file:

var data = new ActiveXObject(" Microsoft.XMLDO M");
data.async = false;
var dataUrl = "data.aspx" ;
data.load(dataU rl) ;
var transform = new ActiveXObject(" Microsoft.XMLDO M");
transform.async = false ;
transform.load( "discussion.xsl t");

result.innerHTM L = data.transformN ode(transform);

result is a div.

Somewhere in my xsl file I have a script that is repeated many times:

<xsl:for-each select="m:Messa ges">
...sometext...
<script language="javas cript">
alert('<xsl:val ue-of select="m:Messa geID" />');
</script>
</xsl:for-each>

My problem is that the Javascript (alert) is not fired. I don't think the
problem is from my xsl file since the "sometext"actua lly appears in the
page.

I wonder, if Javascript rendered on the fly is executed. If it is, how can I do a "execute scripts" or anything like this ?

Thanks !

Steve

Nov 18 '05 #6
I am not sure how you can achieve what you want to achieve your way. But why
not write a few more lines of script to access the xml dom 'data' in
DoTransform()?
I'm tring to build a little chat in asp.net.
Since postbacks are awfull for such scenarios, I want to downloads messages and transforms them in html form, instead of reloading the whole page.

The asp.net codebehind only generates a xml file from a dataset (that's why my data xml file is a .aspx page).
Here is my current version (I removed useless lines for easyier read)
-------------------------------------------------------------------------- -- -
default.aspx:
__________

<HTML>
<HEAD>
<title>defaul t</title>
<script language="javas cript">
<!--
function DoTransform()
{
var data = new ActiveXObject(" Microsoft.XMLDO M");
data.async = false;
var dataUrl = "data.aspx" ;
var last = document.getEle mentById("last" );
data.load(dataU rl) ;

var transform = new ActiveXObject(" Microsoft.XMLDO M");
transform.async = false ;
transform.load( "discussion.xsl t");

result.innerHTM L = data.transformN ode(transform);
}

// -->
</script>
</HEAD>
<body MS_POSITIONING= "FlowLayout ">
<form id="Form1" method="post" runat="server">
<asp:TextBox id="TextBox1" runat="server"
EnableViewState ="False"></asp:TextBox>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button>

<div id="result">
</div>

<script language="javas cript">
<!--
DoTransform();
// -->
</script>
</form>
</body>
</HTML>
-------------------------------------------------------------------------- -- -
data.aspx (result sent to the client using dataset.writexm l):
-------------------------------------------------------------------------- -- -
<?xml version="1.0" standalone="yes "?>
<MessagesDataSe t xmlns="http://www.tempuri.org/MessagesDataSet .xsd">
<Messages>
<MessageID>9</MessageID>
<Author>steve </Author>
<Body>Bonjour </Body>
<TimeStamp>20 04-08-11T16:46:52.215 0393+02:00</TimeStamp>
</Messages>
............... ............... .......
............... ............... .......
</MessagesDataSet >
-------------------------------------------------------------------------- -- -
and my xslt file
-------------------------------------------------------------------------- -- -
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:m="http://www.tempuri.org/MessagesDataSet .xsd">
<xsl:template match="/m:MessagesDataS et">
<table border="1">
<tr>
<td>auto</td>
<td>body</td>
</tr>
<xsl:apply-templates />
</table>
<xsl:for-each select="m:Messa ges">
<script language="javas cript">
alert('<xsl:val ue-of select="m:Messa geID" />');
</script>
</xsl:for-each>
</xsl:template>
<xsl:template match="m:Messag es">
<tr>
<td>
<b>
<xsl:call-template name="format-date">
<xsl:with-param name="date" select="m:TimeS tamp" />
</xsl:call-template>
</b>
<xsl:value-of select="m:Autho r" />
</td>
<td>
<xsl:value-of select="m:Body" />
</td>
</tr>
</xsl:template>
<xsl:template name="format-date">
<xsl:param name="date">
<xsl:value-of select="." />
</xsl:param>
<xsl:variable name="YYYY" select='substri ng($date, 1, 4)' />
<xsl:variable name="YY" select='substri ng($date, 3, 2)' />
<xsl:variable name="MM" select='substri ng($date, 6, 2)' />
<xsl:variable name="hh" select='substri ng($date, 12, 2)' />
<xsl:variable name="mm" select='substri ng($date, 15, 2)' />
<xsl:variable name="ss" select='substri ng($date, 18, 2)' />
<xsl:value-of select="concat( $hh, ':', $mm)" />
</xsl:template>
<xsl:template match="*" />
</xsl:stylesheet>
-------------------------------------------------------------------------- -- -
I do not want to keep the "alert" method, it was just for testing (it should call another metod) if the JS is launched.
Thanks,
Steve

"Joe Fawcett" <jo********@hot mail.com> a écrit dans le message de news:
Oq************* *@TK2MSFTNGP11. phx.gbl...
"Steve B." <n.************ *@airsoftconsul ting.com> wrote in message
news:uh******** *****@TK2MSFTNG P09.phx.gbl...
Hello everybody

In a webpage, I use JS display data from an xml file and a xsl file:

var data = new ActiveXObject(" Microsoft.XMLDO M");
data.async = false;
var dataUrl = "data.aspx" ;
data.load(dataU rl) ;
var transform = new ActiveXObject(" Microsoft.XMLDO M");
transform.async = false ;
transform.load( "discussion.xsl t");

result.innerHTM L = data.transformN ode(transform);

result is a div.

Somewhere in my xsl file I have a script that is repeated many times:

<xsl:for-each select="m:Messa ges">
...sometext...
<script language="javas cript">
alert('<xsl:val ue-of select="m:Messa geID" />');
</script>
</xsl:for-each>

My problem is that the Javascript (alert) is not fired. I don't think the problem is from my xsl file since the "sometext"actua lly appears in the page.

I wonder, if Javascript rendered on the fly is executed. If it is, how

can
I
do a "execute scripts" or anything like this ?

Thanks !

Steve

I think the problem is that when loading initially inline script is
recognised and run, not when added as innerHTML. Although this is an
untested hypothesis you may need to start the alert boxes yourself. Can

you
post a small sample of your source and what you want to be alerted?

--

Joe (MVP - xml)


Nov 18 '05 #7

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

Similar topics

3
6152
by: Randell D. | last post by:
Folks, I'm still learning javascript - I've invested in a couple of books and reading online as much as possible. I'm pretty sure what I am suggesting is possible though I'm trying to weigh up the faults that might go with the suggestion... all opinions welcome. My question: I have a list of links that go to pages that have a similar layout. Could I have a text swap, similar to what I've seen with image swaps (or an image switch)...
5
1339
by: Henry | last post by:
HTML is an acronym for Hyper Text Markup Language. But why is it hyper? Too much java . . . http://takeoff.to/henry
2
1718
by: Mark Preston | last post by:
Its perhaps a bit early to ask, since I'm still doing the page design and haven't got down to the coding yet, but I wonder if anyone can help with a bit of a question. To lay the groundwork, a quick description of the template design for the pages:- 1. There will be a body section of the page consisting of a set of <div> layers. The top level layers will all have the same CSS class to ensure a common design look. 2. At the side or top...
2
8387
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when submitting the form to update the database. The server doesn't have the client side value any more. It seems to me that as I begin to write the client side javacript code for form validation and client side editing capabilities in order to save...
3
1266
by: Diana M | last post by:
Hello, I have started my first asp.net application (beginner). I have 2 text boxes on the form that should contain 2 different dates (beginning and end). It would be nice to have 2 small buttons besides each text box that allow to open little form with calendar. I came from VB world where we had arrays of controls, but here I can't make it. Should I have 2 controls with different names and write code twice in the button click event or...
1
2143
by: google1 | last post by:
Has anyone written this one? Seen such a thing? Please send me a link: Skill Testing Question Exploder --------------------------------------------- Basically the plan is to create the javascript powered form one can surf to to bypass cheating via Window calculator for Skill Testing Question tests. One simply copys the Skill Testing Question from the Contest Webpage
5
5649
by: Joh | last post by:
I'm using mailto to open up an email that have a hyperlink in the body. The hyperlink passes two variables Name and Emailadress. The problem is that only the first variable Name show up in the hyperlink. It seems that javascript takes the & as the end of the body where I use it to separate my variables. Anyone know how to deal with this? "<script...
1
1107
Frinavale
by: Frinavale | last post by:
Hi there! I'm not sure if this question should be posted under the .NET form or the JavaScript form...I just have a general question about JavaScript and .NET. I usually test my JavaScript in static web pages before adding it to my .NET application and I've noticed that if I manually create a static web page that uses JavaScript and then try to run it with Internet Explorer, Internet Explorer "blocks" my JavaScript content. When I...
6
1558
by: John | last post by:
Hello, I was thinking of trying out JavaScript and learn it on my own. I had a few questions though. Is it still popular with businesses today? Is JavaScript bad for search engine opt. (SEO)?
3
2548
by: Zhang Weiwu | last post by:
Hello! I wrote this: ..required-question p:after { content: "*"; } Corresponding HTML: <div class="required-question"><p>Question Text</p><input /></div> <div class="not-required-question"><p>Question Text</p><input /></div>
0
8457
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
8883
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, 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...
0
8788
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...
1
8563
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,...
0
8646
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
7390
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...
0
5675
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
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.