It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

document.getElementById('xxx').src is not working

document.getElementById('xxx').src is not working

Postby nocuser on Wed Jun 02, 2010 12:32 pm

Hi people, I have the following code. It is not working for firefox, IExplorer and Opera. Could you help me? Which could be the error?

thanks,

<script id="url" name="url" language="JavaScript" type="text/javascript" src=""></script>
<script language="JavaScript" type="text/javascript">
var u = document.getElementByName("url");
var l = document.location;
u.src = 'http://localhost/ato.aspx?&key=6346&refnum=jpwAw&location=' + l;
</script>
nocuser
 
Posts: 2
Joined: Wed Jun 02, 2010 12:25 pm

Re: document.getElementById('xxx').src is not working

Postby nocuser on Wed Jun 02, 2010 8:17 pm

Hi, I've been able to do something else... the following script is working for all browsers except IExplorer... it doesn't response...
Could you help me in this topic?
thanks,


<script id="url" name="url" type="text/javascript"></script>
<script type="text/javascript">
var l = document.location;
var u = document.getElementById('url');
u.src = 'http://localhost/ref.aspx?&key=634&refnum=xGa&location=' + l;
</script>
nocuser
 
Posts: 2
Joined: Wed Jun 02, 2010 12:25 pm

Re: document.getElementById('xxx').src is not working

Postby HotNoob on Thu Jun 03, 2010 12:08 am

if that is not working, try using:
Code: Select all
u.setAttribute("src",'http://localhost/ref.aspx?&key=634&refnum=xGa&location=' + l);

instead of

Code: Select all
u.src = 'http://localhost/ref.aspx?&key=634&refnum=xGa&location=' + l;


If that doesnt work, try:
Code: Select all
var l = document.location;
var s=document.createElement("script");
s.setAttribute("type","text/javascript");
s.setAttribute("src",'http://localhost/ref.aspx?&key=634&refnum=xGa&location=' + l);
document.getElementsByTagName("head")[0].appendChild(s);


Also, rather than using document.location, you may want to look into using php instead.

---
well, other than that, im outa ideas :P
HotNoob
100+ Club
 
Posts: 169
Joined: Sun May 02, 2010 1:38 am


Who is online

Users browsing this forum: No registered users and 5 guests