Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
What's up this this Javascript?
Old 05-17-2005, 09:58 PM What's up this this Javascript?
Experienced Talker

Posts: 34
Trades: 0
What's wrong with this javascript? When I view the page from my computer, it functions fine... But when I upload it...Nothing!

I call a javascript file in each page of the site. Here is how I call it:

HTML Code:
<body>
<p>
  <script language="JavaScript" src="header.js"></script>
In the same directory as the page, is this header.js file:

Code:
document.write("<center><table><tr height='25'><td></td></tr><tr><td><img src='../images/universal/banner.gif'></td></tr></table>")
document.write("<table bgcolor='ddddd'><tr><td width='157'><center><font face='Verdana, Arial, Helvetica, sans-serif' size='2'><a href='about.htm'>about</a></font></center></td><td width='157'><center><font face='Verdana, Arial, Helvetica, sans-serif' size='2'><a href='login.htm'>log-in</a></font></center></td><td width='157'><center><font face='Verdana, Arial, Helvetica, sans-serif' size='2'>register</font></center></td><td width='157'><center><font face='Verdana, Arial, Helvetica, sans-serif' size='2'><a href='blog.htm'>announcements/blog</a></font></center></td><td width='157'><center><font face='Verdana, Arial, Helvetica, sans-serif' size='2'>dev forums</font></center></td></tr></table></center>")
document.write("<table><tr height='5'><td></td></tr></table>")
document.write("<table align='center' bgcolor='dddd99'><tr><td width='800'>")
Like I said - Works great on my own computer. Once uploaded (Same file structure, etc) it no longer works...
mtairhead is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-18-2005, 12:38 AM
desertland's Avatar
Skilled Talker

Posts: 86
Trades: 0
I was able to get it to work without any problems. You can try looking at the header.js file directly (type the path to it in the address bar) to make sure it's there. If that works, try setting the 'src' attribute to the full URL of the header.js file instead of just 'header.js'.
__________________
I store my recipes online (the way nature intended) at
Please login or register to view this content. Registration is FREE
desertland is offline
Reply With Quote
View Public Profile
 
Old 05-18-2005, 08:12 AM
Novice Talker

Posts: 13
Location: Sydney Australia
Trades: 0
if you want to test that your javascript file is downloading then just put this in the first line:

alert("Yippee! My file is in the right place!");

if a message box doesn't popup then you've got the path wrong.

the alert box helps with testing almost anything.
__________________

Please login or register to view this content. Registration is FREE
rimian is offline
Reply With Quote
View Public Profile Visit rimian's homepage!
 
Old 05-18-2005, 09:39 AM
Experienced Talker

Posts: 34
Trades: 0
Thank you!

I've taken both of your suggestions:
I loaded just the .js file in Firefox (And in IE) by using the file's complete URL and I also inserted the "alert" statement into the first line... It all works out, but only after I take out the first line of the script!

I decided after posting the intial request for help to do a little testing, and it turns out that once I remove the first line of script in the file, everything works great. Here's the line:

Code:
document.write("<center><table><tr height='25'><td></td></tr><tr><td><img src='../images/universal/banner.gif'></td></tr></table>")
When that line is in the javascript file, nothing in the code executes. In fact, when that line is present, I cannot load the .js file with the complete URL (The page is blank - Same URL!) and when I look at the source of the page, there's nothing there!

Does anyone know what's up?

Thanks for your help,

Andrew
Code:
document.write("<center><table><tr height='25'><td></td></tr><tr><td><img src='../images/universal/banner.gif'></td></tr></table>")

Last edited by mtairhead; 05-18-2005 at 09:40 AM.. Reason: Correcting the [code] tags
mtairhead is offline
Reply With Quote
View Public Profile
 
Old 05-18-2005, 09:55 AM
Experienced Talker

Posts: 34
Trades: 0
Update: It's not that javascript at all! The path to the image does not display the image! When I attempted to load banner.gif using its entire URL, nothing appeared. This annoys me, because I know the URL is correct. I've gone over it several times.

The title of the page is "banner.gif (GIF Image, 32x32 pixels)" - So..The browser does see an image, right??? Why can't I?
mtairhead is offline
Reply With Quote
View Public Profile
 
Old 05-18-2005, 10:43 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
do you have XP with SP2 by some chance? because you are describing the behaviour of the ad blocker and the file is the correct size.

It won't block from the local drive but it does block when served up as a URI.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-18-2005, 04:57 PM I do, in fact...Just got SP2 a few weeks ago.
Experienced Talker

Posts: 34
Trades: 0
Oh I can't believe it. It was the freaken name of the file. Your post about ads made me think of it... It's just a main menu..Not an ad...But I named it "Banner.gif"...What was I thinking... If anything's an ad, it's going to be the file named "banner", and so of course Firefox blocked it.

Thanks,

Andrew
mtairhead is offline
Reply With Quote
View Public Profile
 
Old 05-18-2005, 09:15 PM
Novice Talker

Posts: 7
Trades: 0
lol. Wow complicated!!!
dave123 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to What's up this this Javascript?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26768 seconds with 12 queries