Current location: Hot Scripts Forums » General Web Coding » JavaScript » Add javascript after load?


Add javascript after load?

Reply
  #11 (permalink)  
Old 03-28-06, 03:21 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
I find it very strange that code not wrapped in a function isn't executed when parsed. Are you sure it is correctly written to the page?
Would be good if we had the source of the page after it had recieved a response...
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Reply With Quote
  #12 (permalink)  
Old 03-28-06, 07:45 AM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by TwoD
I find it very strange that code not wrapped in a function isn't executed when parsed. Are you sure it is correctly written to the page?
Would be good if we had the source of the page after it had recieved a response...
Afaik i cant do that.

Im prittey sure its written correctly. I assume that since i cant actually see the code written on the page, its there, correctly escaped. Otherwise it would be a visible response (Yes i have tryd to return text, it does write to the div).

Well anyways, the idea was to try not edit the not so portable response handler. Some day ill rewrite that, but for now, im satisfied with yet another if statement.

Thanks again for helping

Last edited by <?Wille?>; 03-28-06 at 07:47 AM.
Reply With Quote
  #13 (permalink)  
Old 03-28-06, 06:00 PM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
You could put:
Code:
javascript:void(window.open().document.write(document.getElementsByTagName('html')[0].outerHTML))
in the address field of your browser after the response has been sent, then you'd get a new window containing everything on that page (including dynamically added content). This should also trigger the response-script since it is now being added to the page before the initial parsing of the new window.

EDIT: Note that the above code should be on one line and it contains no spaces, those are for some reason added by the forum...
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Reply With Quote
  #14 (permalink)  
Old 03-31-06, 01:23 AM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by TwoD
You could put:
Code:
javascript:void(window.open().document.write(document.getElementsByTagName('html')[0].outerHTML))
in the address field of your browser after the response has been sent, then you'd get a new window containing everything on that page (including dynamically added content). This should also trigger the response-script since it is now being added to the page before the initial parsing of the new window.

EDIT: Note that the above code should be on one line and it contains no spaces, those are for some reason added by the forum...
The whole idea with the page is that it should never have to be reloaded.
imo parsing the response instead of response being the code is better then reloading the whole page to make the response code work.

Also, wouldint this be blocked by most popupblockers?

btw, is there a similar function to php's eval() ?
Reply With Quote
  #15 (permalink)  
Old 03-31-06, 04:52 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
I meant that that code snippet should be used for debugging how the data gets printed to the page. Yes it would be blocked by popup blockers, but simply allow popups for that page while you're debugging.
Copy that string into the address bar of your page after it has received the response, and make sure the space is removed, then you get a new window which tells you what the code looks like after a response has been sent. Then it's easier to see if the php code outputs something strange, even though it's not obvious when looking at it.

Yes, it is called eval() in JavaScript too, but you shouldn't have to use it if your code is structured in a good way.
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
add javascript to a php form aburrows182 PHP 3 08-18-05 11:38 AM
How to add an option for multiple quantities using javascript dlogic JavaScript 1 06-29-05 05:29 AM
Order of vbscript and javascript in ASP marlin ASP 0 06-03-04 03:01 PM
JavaScript to load Applet Letsplaycardspartner JavaScript 1 04-15-04 09:20 AM
Reaaly stuck about javascript over frames muratisik JavaScript 1 12-14-03 11:58 AM


All times are GMT -5. The time now is 11:05 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.