BODY onload is not working


Hi , I'm using ajax to display the xml file. On my html i put
so everytime users go to the main.html, all the information in xml will be displayed after transformed by XSL Now the problem is it gets the errorDisplay is not defined While i did define it in js file this is what I do in js; var xhr = createRequest(); function sendRequest(data) { if(xhr) { xhr.open("GET","product.phpid=" + Number(new Date) +"&value=" + data, true); xhr.onreadystatechange = function() { if (xhr.readyState == 4 && xhr.status == 200) { var divtag = document.getElementById("product"); divtag.innerHTML = xhr.responseText; } } xhr.send(null); } } xhr has another file for it* in php file; load('product.xsl'); $processor = new XSLTProcessor; $processor->importStyleSheet($xsl); $xml = new DOMDocument('1.0'); $xml->load('items.xml'); $transformedXml = $processor->transformToXml($xml); echo($transformedXml); break; } >
in my xsl;
Can anyone tell me what's wrong with the code
Posted On: Sunday 25th of November 2012 09:25:54 PM Total Views:  143
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




JQuery won't work when called by body onload works if directly in script???

I have a form that I am submitting using JQuery, if I copy and paste the form into my main page, everything works fine. If I try to call the form in a separate page to onload none of the buttons work. Is there away around this Not sure if providing my script helps or not, but just in case here it: Code: Messages $(document).ready(function (){ $('#submitNewSend, #submitNewSend2, #submitNewSave, #submitNewSave2').click(function(){ var btn = $(this).attr('id'); if(btn == 'submitNewSend'){ file = 'insertMessage.php'; Msg = 'Your message has been sent'; } else if(btn == 'submitNewSend2'){ file = 'insertMessage.php'; Msg = 'Your message has been sent'; } else if (btn == 'submitNewSave'){ file = 'insertSaveMessage.php'; Msg = 'Your message has been saved'; } else if (btn == 'submitNewSave2'){ file = 'insertSaveMessage.php'; Msg = 'Your message has been saved'; } var data = $('#MessageNew').serialize(); $.post (file,data, function(){ alert(Msg); $('#MessageNew').each (function(){ this.reset(); }); }); return false; }); }); function loadXMLDoc(File,ID){ if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200){ document.getElementById(ID).innerHTML=xmlhttp.responseText; } } xmlhttp.open("POST",File,true); xmlhttp.send(); } And the getloadCompose.php is: Code: Compose Message To: Subject: Message: Enter Message I know I have buttons doing the same function,there is an ease of use reason for it. I can put everything on my main page if necessary, but it wouldn't really be doing exactly what I want it to do.
VIEWS ON THIS POST

80

Posted on:

Wednesday 17th October 2012
View Replies!

alt to using body="onload()" or jQuery's $(document).ready...

what can i use in place body="onload()" or jQuery $(document).ready()... in other words, run some funcs one the document has loaded. (don't want to use jQuery for this) window.onload doesn't work for this. i tried window.document.body.onload... that's not right
VIEWS ON THIS POST

72

Posted on:

Saturday 20th October 2012
View Replies!

Can be modified?

What I mean is that my tag currently is like this: Code: I would like to insert a pop-up contact form which requires the body tag to be like this: Code: Not quite sure how to merge these - indeed can I merge them Perhaps better to make the body class (top example) execute elsewhere THANKS!!
VIEWS ON THIS POST

176

Posted on:

Saturday 20th October 2012
View Replies!

insert text to the body of an html file?

I want to have some text in an html file, but I don't want to have several paragraphs in that file. Can I use Javascript to insert text from a different location If so, how do I do that Can it really be impossible I mean, you do it with pictures all the time... I just want to do it with text instead... I can't post any code because I don't know how to do it. >_>" I've been trying to find stuff online, but most of that was to put a whole window inside it, with scrollbars and stuff.
VIEWS ON THIS POST

146

Posted on:

Saturday 10th November 2012
View Replies!

Anybody know of any solutions for converting Excel?

Does anybody have any solutions for converting Excel Spreadsheet calculators into HTML, most likely with Javascript commands. There are a couple software companies like SpreadsheetConverter and ExcelEverywhere that do this, but does anybody know of any free solutions out there. Here's a CNET link to ExcelEverywhere's description: http://download.cnet.com/ExcelEverywhere-for-HTML/3000-2077_4-10211203.htmltag=mncol . I'm looking for something that can function the same as this.
VIEWS ON THIS POST

131

Posted on:

Saturday 10th November 2012
View Replies!

In the body or in the head?

No I'm not talking about POT. I assumed since this was a javascript forum you would suddenly think the question was "where to put the code" Some say inside the head is better. Others say inside the body is fine. While others don't care and do both. If you talk to some one who has chosen one over they other either is a best practice to them. Why would either be a best a practice I not talking about the script attribute of html. I mean the script tags and the code that goes in them. //whatch you down there script tag!! //nothin! what are you doin up there I kinda get the "occasion for this or that" scenario. I'm just wondering if there is enough of a reason to take it way beyond opinion. I mean way beyond. Like stuff will happen dude. If you put that there stuff will happen that is going to feel like a rough massage from a hairy burly dude that has eyes for you. Unless you like that kinda stuff. I don't judge.
VIEWS ON THIS POST

58

Posted on:

Monday 12th November 2012
View Replies!

Calling multiple functions with a single body onload call

Greetings. So, I have a web page that has a short flash show on it, then it redirects to the main site index page, using a setTimout in body onload. That was all working fine. Now I need to add an OS detection function to redirect iphone and ipad users immediately (bypassing the flash pape). So, I have 2 functions that need to be in the body onload. I figured the logical thing to do would be to write another function that calls the first 2, then put that one in the onload. But now nothing is working. I have played with in for an hour with no luck. Just as a note: Original, before I had to add the OS detection, there was just the delayer function, and it was called thusly: which worked fine. I ran it through firebug, and it said that 'callFuncs() is not defined', and I am not sure why (yes I is a noob). Please take a look and let me know some ideas, hints, or a good tutorial:
VIEWS ON THIS POST

124

Posted on:

Monday 12th November 2012
View Replies!

Can somebody explain this code: JavaScript Function?

VOWELS REMOVER function convert() { enter=prompt("Enter Strings",""); var str = enter.replace(/a|e|i|o|u/ig,'*'); alert(str); } convert() My Questions: 1. Why do I need to put / at the beginning of replace. 2. What is the purpose of /ig (If i remove it, it only converts 1 vowels to *). 3. What is the meaning of | is that "OR" statement\t
VIEWS ON THIS POST

128

Posted on:

Monday 12th November 2012
View Replies!

UnLoad out of body

, Has anyone of you a working sample how to code an UnLoad method out of body tag with javascript I have a common problem where a javascript function should be called after a certain window is closed. I ...
VIEWS ON THIS POST

59

Posted on:

Friday 16th November 2012
View Replies!

Use Prototype/Scriptaculous in body?

all, Is there a way to use/load Prototype and Scriptaculous from the body I'm in a weird situation on a cms; I can use javascripts on my page but don't have access to the head. A year or so ago I remember running across a site where the guy had altered some of the prototype code to get it to work from outside the head, but I can't find those instructions again.
VIEWS ON THIS POST

196

Posted on:

Friday 16th November 2012
View Replies!

can somebody fix the problem?

a) which language b) why the hell haven't you used code tags c) You have neither stated what it SHOULD do, or what it DOES do - how can we "fix it". d) I hope a mod moves this to a proper forum so I can give you a proper de-rep for this crap.
VIEWS ON THIS POST

308

Posted on:

Friday 16th November 2012
View Replies!

problem with the body and style.....

I'm having a bit of a problem getting the digital traditional flash and contact info to show when i click on the animated slide menu.... i think its my style's and body and how im calling them from the java script, in the body tag... a little guidance would be nice :) thanks ardillo /* // start of div reaction// jQuery(document).ready(function($){ $("#a1").addClass("active").css({left:"75px"}); $("#digital").hide(); $("#traditional").hide(); $("#flash").hide(); $("#contact").hide(); $("#workContainer").hide(); $("a[class!='link']").click(function(){ return false; }); $("a:eq(0)").click(function(){ if($("#a1").hasClass("active")){ end(); } $(".active").animate({left: "-675", opacity: "hide"}, 800, function(){ $(this).removeClass("active"); $("#a1").animate({ left: '0', opacity: "show"}, 800).addClass("active"); }); }); $("a:eq(1)").click(function(){ if($("#digital").hasClass("active")){ end(); } $(".active").animate({left: "-675px", opacity: "hide"}, 800, function(){ $(this).removeClass("active"); $("#digital").animate({ left: '0', opacity: "show"}, 800).addClass("active"); $("#workContainer").animate({ left: '0', opacity: "show"}, 800); }); }); $("#nav a[class!='work']").click(function(){ $("#workContainer").animate({ left: '175', opacity: "hide"}, 800); }); $("a:eq(2)").click(function(){ if($("#traditional").hasClass("active")){ end(); } $(".active").animate({left: "-675", opacity: "hide"}, 800, function(){ $(this).removeClass("active"); $("#traditional").animate({ left: '0', opacity: "show"}, 800).addClass("active"); }); }); $("a:eq(3)").click(function(){ if($("#contact").hasClass("active")){ end(); } $(".active").animate({left: "-675", opacity: "hide"}, 800, function(){ $(this).removeClass("active"); $("#contact").animate({ left: '0', opacity: "show"}, 800).addClass("active"); }); }); //----------------------SCROLL TO------------------ $("#workContainer a:eq(0)").click(function(){ $('#item').scrollTo('li:eq(0)', 800); }); $("#workContainer a:eq(1)").click(function(){ $('#item').scrollTo('li:eq(1)', 800); }); $("#workContainer a:eq(2)").click(function(){ $('#item').scrollTo('li:eq(2)', 800); }); $("#workContainer a:eq(3)").click(function(){ $('#item').scrollTo('li:eq(3)', 800); }); $("#workContainer a:eq(4)").click(function(){ $('#item').scrollTo('li:eq(4)', 800); }); $("#workContainer a:eq(5)").click(function(){ $('#item').scrollTo('li:eq(5)', //end// //start of main menu slide open// $(document).ready(function(){ lastBlock = $("#digital"); maxWidth = 210; minWidth = 75; $("ul li a").hover( function(){ $(lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:400 }); $(this).animate({width: maxWidth+"px"}, { queue:false, duration:400}); lastBlock = this; } ); }); ul{ list-style: none; padding: 0; float:right; } ul li{ float: left; padding: 10px; display: block; margin-right: 10px; background:url(greymenubg.jpg) no-repeat; } ul li a{ display: block; overflow: hidden; height: 75px; width: 75px; background:#FFFFFF; } #digital{ width: 70px; background-color:#FFFFFF; } ul li img{ position: absolute; border: none; width:70px } ul li p{ width:70px; margin: 0; padding: 0; width: 120px; display: block; margin-left: 85px; background-color:#999999; color:#FFFFFF; } .span { color:#CCCCCC; cursor:pointer; } div { float:right; background-image:url(greymenubg); }
VIEWS ON THIS POST

96

Posted on:

Friday 16th November 2012
View Replies!

In the body or in the head?

No I'm not talking about POT. I assumed since this was a javascript forum you would suddenly think the question was "where to put the code" Some say inside the head is better. Others say inside the body is fine. While others don't care and do both. If you talk to some one who has chosen one over they other either is a best practice to them. Why would either be a best a practice I not talking about the script attribute of html. I mean the script tags and the code that goes in them. //whatch you down there script tag!! //nothin! what are you doin up there I kinda get the "occasion for this or that" scenario. I'm just wondering if there is enough of a reason to take it way beyond opinion. I mean way beyond. Like stuff will happen dude. If you put that there stuff will happen that is going to feel like a rough massage from a hairy burly dude that has eyes for you. Unless you like that kinda stuff. I don't judge.
VIEWS ON THIS POST

75

Posted on:

Monday 19th November 2012
View Replies!

How we can fire onLoad event of body using js?

Hi Guys, I want to fire onload event of body tag on click of a HTML button.Like if I click on the button the body's onload event will fire and a function called on onload event of body tag will execute. So anybody knows how to accomplish this.Just give me a hint or syntax. Answers will really appreciated.
VIEWS ON THIS POST

118

Posted on:

Wednesday 21st November 2012
View Replies!

How can I put head code in the body

There is a javascript code I want to use on my blog. This code is supposed to be placed in the head section, not the body section. It works great on a test web page I created, but I want it on the blog. The problem is -- I do not have access to the head section of the blog. Is there a way around this Can I "fool" the blog to accept the code in the body section
VIEWS ON THIS POST

122

Posted on:

Wednesday 21st November 2012
View Replies!

Running jQuery inside tag?

Ok, so I'm not sure if this can be done, but I'm really hoping it can be. I have jQuery.js referenced in the of my document. Now, what i'm trying to do is run the following script: ... $("a#tryIt").click(function() { alert("Foo"); }); ... My Link However, this is not working. Is it because it's in the If so, is there anyway to make it work within the body Any help is greatly appreciated! I'm only 1 day into to learning jQuery. This post has been edited by coryroc: 12 June 2009 - 08:53 AM
VIEWS ON THIS POST

78

Posted on:

Wednesday 21st November 2012
View Replies!

Passing variable from function to html body...

Can someone help me pass a variable from a function in a header to the body of an html page. Header Code: function doLoad() { xml = new XMLHttpRequest(); xml.onreadystatechange = function() { var elem = null; var rss_url ...
VIEWS ON THIS POST

138

Posted on:

Thursday 22nd November 2012
View Replies!

Somebody here using Dojotoolkit?

Just asking :P
VIEWS ON THIS POST

63

Posted on:

Saturday 24th November 2012
View Replies!

height of tbody creating problem

Hi Sorry for my bad english. I am using a section and I had set height of Tbody .But When the number of rows are small the height of the row will increase. I have tried to use max-height instead of height. But it doesn't works. I am using Mozilla Firefox. Can anyone give a solution for this.
VIEWS ON THIS POST

109

Posted on:

Saturday 24th November 2012
View Replies!

javascript in mail body

hello.... is javascript works in mailbody i mean admin sends registration form through email to new users. for that registration form validation javascript is not working. any suggestions
VIEWS ON THIS POST

109

Posted on:

Saturday 24th November 2012
View Replies!