How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask Russell H. Your Own Question
Russell H.
Russell H., Programmer & Coder
Category: Programming
Satisfied Customers: 11059
Experience:  Programmer & Coder
Type Your Programming Question Here...
Russell H. is online now
A new question is answered every 9 seconds

I have a javascript question which I think should be able to

Customer Question

hey, I have a javascript question which I think should be able to be done.
We use a program to create web pages for us. Unfortunately, some of the new code that it compiles messing with one of our systems. It's in the tags and is javascript:
onload = init
if( is.webkit )
onbeforeunload = finish
onunload = finish
We need to replace that (we are launching this content within a "wrapper" so should be able to write to the page) with this:
onload = init
onunload = finish
I can get close (I can find the scripting using document.scripts), but I can't seem to modify that text. I've done it before with things like classes and tags, but I've never tried to get at the page javascript. Is this something that can be done?
Submitted: 2 years ago.
Category: Programming
Customer: replied 2 years ago.
I don't think I need this answered anymore, but am not sure how to close it. I've found a workaround for now that will get us by, but if I can't remove this from the queue, then it would be nice to know, I suppose, if this can be done.Thanks!
Expert:  Russell H. replied 2 years ago.
Hi, thank you for contacting My name is Russell. I will do my best to provide the right answer to your question.
If the code is generated dynamically, then you may not be able to edit it directly.
Dynamically generated code is 'written' to the web page, rather than an inherent part of it. It can be generated by the code content of another file, where only the file name is ***** ***** the web page itself as stored on the server... but when that file name, in the web page, is executed as code, it 'writes' more content to the web page. So, if there is a PHP file or a JS file, etc. (other file types too, but those are common ones) that is mentioned in the web page, the code in question may be generated by the PHP or JS file, not by the web page itself, and editing that PHP code or JS code file would be needed, to alter the web page tags etc. that it generates.
Using such a code file, to generate and 'write' more code, is somewhat unusual practice, but quite possible I suppose.
Let me know if that helps. I thought that your question deserves an answer, even if you no longer need one.