script.src pick out

O

Oliver Albrecht

Hello together,

how can I grab at the script.src object (to read / write the url)? And
this at the best before the finished-load (onload) of the side!?

(my 1. post here)
 
J

jshanman

Oliver said:
Hello together,

how can I grab at the script.src object (to read / write the url)? And
this at the best before the finished-load (onload) of the side!?

(my 1. post here)

You could dynamicly add the script object to the DOM:

var scriptObj = document.createElement("script");
scriptObj.type = 'text/javascript';
scriptObj.src = "http://www.yourdomain.com/path/to/your/file.js";
document.body.appendChild(scriptObj);

Using this method, you coudl specify the src as a server page
(php,asp,jsp) that generates javascript depending on what you want to
generate.

scriptObj.src =
"http://www.yourdomain.com/path/to/your/file.php?var1="+somevar+"&var2="+somevar2;

I have a comparision with this and the XMLHttpRequest object at:
http://www.endeavorpub.com/d/stress.php

- JS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top