onload works in page A but not Page B

D

DrKen

I coded an onload call in the body tag of a page:
<body id="page-aboutme" onload="executeOmniture()">

In page A, I know this works, both from running it locally and running
it as part of an application. In page B, my function does not work
and I don't get why. I expect code to work the same from place to
place. I copied from A to B.

In page B, I have

<body id="page-aboutme" onload="executeOmniture()" >

Inside the FORM is

<INPUT TYPE="HIDDEN" NAME="Email$95Address" AnnType="Text Entry"
AnnRequired="false" AnnValidateEmail="false" VALUE="<pstag:profile
value="Individuals.CS-Appl Biographic.Email_Address" poutput="Text" /
" SIZE=32 MAXLENGTH=70 id="omniEmail">

So the id of the item is defined. The function should be called upon
the onload event.

Just before the </body> tag:
<!-- Omniture SiteCatalyst code -->
<script type="text/javascript">

alert("Do alerts work?");

var omniIdentifier = null;
function executeOmniture()
{
omniIdentifier = document.getElementById("omniEmail").value;
//<![CDATA[
s.server="home.apu.edu";
s.channel="Admissions";
s.pageName="Applications: APS: Start";
s.hier1="applications,aps";
alert("omniIdentifier: " + omniIdentifier);
s.events="event8:APS"+ "TEST" + omniIdentifier;
var s_code=s.t();if(s_code)document.write(s_code)//-->
//]]>
}
</script>
<!-- End Omniture SiteCatalyst code -->


In the JavaScript block, the initial alert works, but I am getting an
error that the id, omniEmail is not defined. Since this works in
another page, I can't figure out what I did wrong when I added this.
Any suggestions how to find it? Thanks.

Ken
 
J

Jukka K. Korpela

Since this works in
another page, I can't figure out what I did wrong when I added this.
Any suggestions how to find it? Thanks.

Check out line 42. The error might be there. Or on line 1911.

Seriously, post the URLs.
 
D

dhtml

I coded an onload call in the body tag of a page:
<body id="page-aboutme" onload="executeOmniture()">

In page A, I know this works, both from running it locally and running
it as part of an application.  In page B, my function does not work
and I don't get why. I expect code to work the same from place to
place.  I copied from A to B.

In page B, I have

<body id="page-aboutme"  onload="executeOmniture()" >

Inside the FORM is

<INPUT TYPE="HIDDEN" NAME="Email$95Address" AnnType="Text Entry"
AnnRequired="false" AnnValidateEmail="false" VALUE="<pstag:profile

What sort of markup is that? It's not HTML.
value="Individuals.CS-Appl Biographic.Email_Address" poutput="Text" /

What is that slash there? Perhaps the parser stops there and does not
parse the id.
" SIZE=32 MAXLENGTH=70 id="omniEmail">

So the id of the item is defined.  The function should be called upon
the onload event.

Just before the </body> tag:
<!-- Omniture SiteCatalyst code -->
<script type="text/javascript">

    alert("Do alerts work?");

    var omniIdentifier = null;
  function executeOmniture()
        {
          omniIdentifier = document.getElementById("omniEmail").value;
//<![CDATA[

CDATA would make sense for XML. The markup isn't XHTML -- way too many
errors.
        s.server="home.apu.edu";
        s.channel="Admissions";
        s.pageName="Applications: APS: Start";
        s.hier1="applications,aps";
        alert("omniIdentifier: " + omniIdentifier);
        s.events="event8:APS"+ "TEST" + omniIdentifier;
        var s_code=s.t();if(s_code)document.write(s_code)//-->
//]]>}

</script>
<!-- End Omniture SiteCatalyst code -->
Omniture, I am sorry to say, is unreliable and badly coded. ForeSee
results is about the same.

In the JavaScript block, the initial alert works, but I am getting an
error that the id, omniEmail is not defined. Since this works in
another page, I can't figure out what I did wrong when I added this.
Any suggestions how to find it?  Thanks.

Strong expectations about what the script should do can't be made when
the underlying document is using invalid HTML.
 
D

Denis McMahon

What is that slash there? Perhaps the parser stops there and does not
parse the id.

I think the slash is terminating the <pstag that's being handled by some
sort of pre-processor, and my assumption based on previous posts by the
same poster would be that:

<pstag:profile value="Individuals.CS-Appl Biographic.Email_Address"
poutput="Text" />

is, for some pre-processor that the OP uses, broadly equivalent to

<?php /* run a database query to get an email address and then echo the
email address */ ?>

ie, it fills in the value of the hidden field with an email address.

Of course, it only does that if the pre-processor is working properly,
and in the past the op has shown a misunderstanding that the pre-
processor code is executed client side after he downloads the page, when
I'm pretty sure that to work it has to be executed server side before the
page is sent to the browser, so this could be another example of the op
testing a file that is intended to go through the pre-processor by
opening it directly as a file in his browser.

Pre-processor hasn't parsed the code, so he's got a mishmash of crud.

Rgds

Denis McMahon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top