Jump to content

Maximus

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by Maximus

  1. Hmm, I tried your code and my browser froze. I'm assuming its because of the loop :SHowever, I found another way to accomplish my goal. By inserting an image into the ajax loaded content I was able to add the onLoad trigger to it. Example:<img src="test.gif" onLoad="do(this);" style="display: none;"> Its not a perfect solution as it is sort of primitive, but it seems to work really well and is fairly easy to use. The additional style code hides it. Small 1x1 images are perfect for this :)EDIT: In FireFox all is fine, but in IE(6) the function thats with the image is being called endless times...for whatever reason :-( I have yet to figure out how to fix this.
  2. Thanks a lot for such a responsive post!My explanation wasn't too good, but I think you understood me.I don't understand why having this (below) in the content that is being loaded, isnt working. <script type="text/javascript">go('resources.ic', 'resources');<\/script> I could try your first suggestion oh just modifiying the function that loads the content to call another funtion, but then that would only be a temporary solution and really woulnt help me that much. I need the content that is loaded via AJAX to call a function and there seems to be no way of doing this.
  3. I am currently doing a lot of work with AJAX based web applications, and I find it to be a real drag that you cannot use the "onLoad" event to call functions when loading sections of a page with AJAX.My problem is that I have to execute a piece of code as soon as the page is loaded (dynamically, using ajax). On normal sites, this would work with the onLoad property, so once the page has loaded, that event would trigger a JS function of my choice. But with AJAX, only a part of the site "refreshes/loads" so this event handler is useless.I have tried simply putting the function I want to execute upon loading in script tags like so: <script type="text/javascript">loadContent('pagename', 'divname');</script> but with no success :-(Does anyone know how to solve this problem? This is really important to me, and I would really appreciate any help, thanks.
  4. After its finished loading...I know I can use onreadystate, but thats too complicated, because this whole thing is inside a HUGE JS function. Isen't there another way, using simple html dom?I mean, it loads html objects via ajax instead of refreshing the page, but I don't see why "onLoad" doesnt work for those objects as it does when you refresh the whole page.
  5. Hey, I am using AJAX to request a page, so I cannot use "body onload", because the page is loaded into an existing HTML page.Instead, I tried using the following in my ajax-loaded page: <script type="text/javascript" onLoad="java script:changeText()"></script> I tried that because in the w3schools js tutorial it said that the onLoad event works with <script>. http://w3schools.com/jsref/jsref_onload.aspAnyways, my code didn't do anything...the function itself works though, I tested it with a link and "onmouseover".I just need the function "changeText" to be executed as soon as the page is loaded. Keep in mind im using ajax, so the page isent actually refreshed.Help is greatly appreciated!
  6. Thank you, that works.Lastly, is there a way to make the newly added text in red, and leave the existing text's color alone?Right now the script changes the color of the default/old text as well...
  7. Yes that worked! However, one last thing.I used the firstChild.data before because it added the "new text" (req.responseText) to the existing div. The code you gave me merly clears the div and displays the text.I tried going: var element = document.getElementById("response_register");element.innerHTML = req.responseText + element;element.style.color = "#ff0000"; That displays the text and "[object HTMLDivElement]" (no quotes). Ugh.
  8. Not really what I'm looking for...see this is all part of a bigger JS function that submits a form via ajax and displays the result.document.getElementById("response_register").firstChild.data=req.responseText;document.getElementById("response_register").innerHTML.style.color="#FF0000"; I just need to change the color of "req.responseText". I tried the above code, but it doesnt work, just displays the text returned by the server, WITHOUT color.
  9. Most of the tutorials at w3schools are exellent (php, html), however the DOM ones are really bad, in my opinion, because they fail to explain it properly. At least I was really confused after reading through it.All I want to know, is how to change the text in a div..., the simplest thing, and that isen't even on w3schools (correct me if I am wrong). <div id="response_register">default-text</div>document.getElementById("response_register").firstChild.data='new-text'; The above will output (when used in/with a JS function):new-textdefault-textThis is what I want, but I when I use html formatting like <font color=red>Hello</font> it displays the html code as well, without changing the color. Anyone know how to do that? I also experimented with the innderHTML property, to no success.
×
×
  • Create New...