Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-11-2010, 12:14 PM   PM User | #1
nocuser
New to the CF scene

 
Join Date: Mar 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
nocuser is an unknown quantity at this point
javascript working in Chrome, but no in other browsers

Hi people, I have the followin code:
<html>
<head>
<title>My Page</title>
</head>
<BODY>
<script id=url language=javascript src=""></script>
<script type="text/javascript">
document.getElementById("url").src = "http://www.mysite.com/mypage.aspx";
</script>
</body>
</html>


This code is working fine with Chrome, but it doesn't for other browser (IE, Firefox, Opera)... I've not been able to find where the problem is... IE gives me an error: internet explorer could not open the website. Operation aborted. The other browsers don't show any message.
Could you help me with this?
Thanks,

Last edited by nocuser; 03-11-2010 at 12:19 PM..
nocuser is offline   Reply With Quote
Old 03-12-2010, 09:33 AM   PM User | #2
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
You document needs a Doctype. Attributes values need double quoted. language is deprecated, use type="text/javascript" instead of language=javascript. You should rather use a function called onload. Finally, I don't see the point of your code.
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Old 03-12-2010, 12:04 PM   PM User | #3
nocuser
New to the CF scene

 
Join Date: Mar 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
nocuser is an unknown quantity at this point
Thanks kor, this code is an example, my code is a bit more complex than it... but I wanted to put a simple code where everybody could see the problem.
Anyway, the problem with IE is already happening...
nocuser is offline   Reply With Quote
Old 03-12-2010, 01:58 PM   PM User | #4
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
but I wanted to put a simple code where everybody could see the problem.
Then, please follow the instructions from Kor and repost your modified code, so that we can test in the specified browsers.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 03-12-2010, 02:09 PM   PM User | #5
nocuser
New to the CF scene

 
Join Date: Mar 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
nocuser is an unknown quantity at this point
The modified code is:

<script id="test" type="text/javascript"></script>

<script type="text/javascript">
document.getElementById("test").src = "http://www.mysite.com/mypage.aspx?&var1=value&var2=value2";

</script>


Mypage.aspx returns some code depending on the variables, that code may open another .aspx file for example.

Now, the previous script is working for all the browsers, except IE...
nocuser is offline   Reply With Quote
Old 03-12-2010, 02:13 PM   PM User | #6
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
The error might not be in the way you are linking the script, but in the script itself. Could you post the generated script by that url?
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 03-12-2010, 02:49 PM   PM User | #7
nocuser
New to the CF scene

 
Join Date: Mar 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
nocuser is an unknown quantity at this point
The code returned is:

Code:
document.write("<SCRIPT> function openWindow(programa) 
				{ var omenu = window.open(programa, \"\", \"width=500,height=500,left=20,top=20,scrollbars=no,menubar=no,toolbar=no,resizable=no,directories=no\"); 
					omenu.focus(); }; 
				</script>
				<a href=javascript:openWindow(\"http://www.mysite.com/mypage.aspx?&var1=val1&var2=val2\")> 	
					<img src=http://www.mysite.com/icons/image.png></a>")
Thanks,

Last edited by Kor; 03-12-2010 at 03:34 PM.. Reason: wrap the code [code[/code], disable smilies and get rid of the colored text
nocuser is offline   Reply With Quote
Reply

Bookmarks

Tags
chrome, firefox, getelementbyid, opera

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:15 PM.


Advertisement
Log in to turn off these ads.