| | |
is it possible to over write internal java script?
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
Is it possible to overwrite internal javascript? I am working for a non profit as an internship and they want to escape a template that almost all of the non profits in that organization have to use, the catch is the template is written in Javascript if it is possible to over ride it please tell me as I really need to know ASAP.
If I helped you I would appreciate it if you would give me some reputation.
Follow the new Social Network Planet Zuda On twitter. Planet Zuda should go live sometime in 2010.
Follow the new Social Network Planet Zuda On twitter. Planet Zuda should go live sometime in 2010.
my be this would(i have not tired it). Javascript code are written in <script></script> tags. So search these tags in the document by using: var sTag = document.getElementsByTagName("script"). This will give u an array of script tags. Now over write them by using sTag[0].innerHTML = "your javascript code";
If this work please let me know?
If this work please let me know?
•
•
•
•
my be this would(i have not tired it). Javascript code are written in <script></script> tags. So search these tags in the document by using: var sTag = document.getElementsByTagName("script"). This will give u an array of script tags. Now over write them by using sTag[0].innerHTML = "your javascript code";
If this work please let me know?
If I helped you I would appreciate it if you would give me some reputation.
Follow the new Social Network Planet Zuda On twitter. Planet Zuda should go live sometime in 2010.
Follow the new Social Network Planet Zuda On twitter. Planet Zuda should go live sometime in 2010.
Okay I have searched the whole javascript and they do not use the var command at all they use javascript in a odd way just for images. If there is a way to overwrite it I would be happy and so would my boss.
If I helped you I would appreciate it if you would give me some reputation.
Follow the new Social Network Planet Zuda On twitter. Planet Zuda should go live sometime in 2010.
Follow the new Social Network Planet Zuda On twitter. Planet Zuda should go live sometime in 2010.
Hi tiger86, if u can explain ur problem little bit more, i want to know what exactly u want to do.
var is not a command but a way to declare a variable in javascript.
I am explaining my prev. post again, if u still did not get ur problem solved, explain ur problem in detail.
first i want to tell u what i understand from ur post: You want to overwrite the javacript at run-time. if this is correct then my post will help u otherwise explain me ur problem. here is want i explained in prev post. for example u have a page:
if u want to change js code in above page,
this a js code todo that :
var tags = document.getElementsByTagName("script");
//Now changing the js code
tags[0].innerHTML = "your new js code should be written here as a string";
again i had not tested it. please let me know how it works?
var is not a command but a way to declare a variable in javascript.
I am explaining my prev. post again, if u still did not get ur problem solved, explain ur problem in detail.
first i want to tell u what i understand from ur post: You want to overwrite the javacript at run-time. if this is correct then my post will help u otherwise explain me ur problem. here is want i explained in prev post. for example u have a page:
html Syntax (Toggle Plain Text)
<html> <head></head> <body> <script> function myfunct() { //do something } </script> </body> </html>
if u want to change js code in above page,
this a js code todo that :
var tags = document.getElementsByTagName("script");
//Now changing the js code
tags[0].innerHTML = "your new js code should be written here as a string";
again i had not tested it. please let me know how it works?
Last edited by peter_budo; Apr 30th, 2008 at 8:51 am. Reason: Keep It Organized - plase use [code] tags
It works!
If I helped you I would appreciate it if you would give me some reputation.
Follow the new Social Network Planet Zuda On twitter. Planet Zuda should go live sometime in 2010.
Follow the new Social Network Planet Zuda On twitter. Planet Zuda should go live sometime in 2010.
the code luckychap posted works but I would not suggest using it unless it is your own website and you are not connected to a national website.
If I helped you I would appreciate it if you would give me some reputation.
Follow the new Social Network Planet Zuda On twitter. Planet Zuda should go live sometime in 2010.
Follow the new Social Network Planet Zuda On twitter. Planet Zuda should go live sometime in 2010.
•
•
Join Date: Nov 2009
Posts: 2
Reputation:
Solved Threads: 0
Ok, and what if we have a code like this?
In this case, how can we replace the code loaded with example.js?
Let me be more informative. There is this issue on one site - the script it loads via src attribute in script tag is cut down by the server, and instead of having a 362kb successfully loaded script, I've something like 160kb cut one. So I'm trying to write a Greasemonkey userscript, which can overwrite the cut down script with code that it has in itself. For now, I'm not having any success with this problem. Can anyone help me with this?
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<script src="example.js" type="text/javascript"></script>
Let me be more informative. There is this issue on one site - the script it loads via src attribute in script tag is cut down by the server, and instead of having a 362kb successfully loaded script, I've something like 160kb cut one. So I'm trying to write a Greasemonkey userscript, which can overwrite the cut down script with code that it has in itself. For now, I'm not having any success with this problem. Can anyone help me with this?
Last edited by sozeran; Nov 10th, 2009 at 2:24 am.
0
#9 Nov 11th, 2009
As I have explained how to get <script> tags. Say we have an array of tags 'scripts'.
Is that what u r looking for?
javascript Syntax (Toggle Plain Text)
var orginalSrc = "example.js", newSrc = "new.js"; // Looping through all the tags for(var i = 0; i < scripts.length; i++) { if(scripts[i].src == originalSrc) { scripts[i].src = newSrc; break; } }
Is that what u r looking for?
Last edited by Luckychap; Nov 11th, 2009 at 11:40 am.
When you think you have done a lot, then be ready for YOUR downfall.
•
•
Join Date: Nov 2009
Posts: 2
Reputation:
Solved Threads: 0
0
#10 Nov 11th, 2009
•
•
•
•
As I have explained how to get <script> tags. Say we have an array of tags 'scripts'.
javascript Syntax (Toggle Plain Text)
var orginalSrc = "example.js", newSrc = "new.js"; // Looping through all the tags for(var i = 0; i < scripts.length; i++) { if(scripts[i].src == originalSrc) { scripts[i].src = newSrc; break; } }
Is that what u r looking for?
![]() |
Similar Threads
- Frame detection possible? (HTML and CSS)
- noobie asking for assistance with file parsing... (Perl)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Link with Focus
- Next Thread: add text onclick to textarea where carot is
Views: 2060 | Replies: 9
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
acid2 ajax ajaxexample ajaxjspservlets array autoplay blackjack browser captcha captchaformproblem cart close codes css date debugger decimal dependent design developer disablefirebug dom download element embed engine enter error events ext file firefox flash focus form frameworks game gears getselection google gxt hiddenvalue highlightedword hint html ie7 iframe index java javascript javascripthelp2020 javascripts jquery jsp libcurl listbox maps margin marquee masterpage media menu mp4 onerror onmouseoutdivproblem onmouseover parameters paypal pdf php player position post problem programming prototype rated rating redirect safari scale scriptlets scroll search security size software solutions sources starrating synchronous toggle tweet unicode variables w3c web webkit webservice window





