|
| |
|
|
CelticDragon
Posts: 227 Joined: 11/14/2003 From: Dublin, Ireland Status: offline
|
Removing Javascript - 9/13/2004 6:42:05
Hi guys, I think I attempted this question before but didn't figure it out... I have on my main pages quite a bit of javascript. On every header include I have a random picture script and on the main page I have a random quote generator..... These are affecting how the search engines view the pages and not registering my actual text.... how do I go about putting these in off page javascript files? I'm presuming that I copy the whole lot of the script between the <Javascript> bit but without those bits and putting into a text file and calling that script.js or whatever.... then how do I declare it on my page? Thanks for the help! Stephen
_____________________________
I Lost My Stuff - If you lost it, someone found it!
|
|
|
|
Giomanach
Posts: 6090 Joined: 11/19/2003 From: England Status: offline
|
RE: Removing Javascript - 9/13/2004 6:55:55
Number one: <Script Language='JavaScript'>
<!-- Begin
var theImages = new Array() // do not change this
theImages[0] = 'includes/1.jpg'
theImages[1] = 'includes/2.jpg'
theImages[2] = 'includes/3.jpg'
theImages[3] = 'includes/4.jpg'
theImages[4] = 'includes/5.jpg'
theImages[5] = 'includes/6.jpg'
theImages[6] = 'includes/7.jpg'
theImages[7] = 'includes/8.jpg'
theImages[8] = 'includes/9.jpg'
var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
preBuffer = new Image()
preBuffer.src = theImages
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<img src="'+theImages[whichImage]+'">');
}
// End -->
</script> Copy eiverything between the <script></script> tags into a fresh Notepad doc, and save it as imagechange.js And replace the lot with: <script src="imagechange.js" type="text/javascript" language="JavaScript"></script> Leave the coding to change the images in the header alone. Number Two: <SCRIPT LANGUAGE="JavaScript">
<!-- Begin
theDate= new Date();
var day = theDate.getDate();
var year = theDate.getYear();
year = (year < 2000) ? year + 1900 : year;
var textdate = (theDate.getMonth() + 1) + '/' + theDate.getDate() + '/' + year;
var numquotes = 31;
quotes = new Array(numquotes+1);
quotes[1] = "Spring to mind<br></b>- <i>Think of suddenly";
quotes[2] = "One in a million<br></b>- <i>A unique person";
quotes[3] = "Be miles apart<br></b>- <i>Not close to reaching an agreement";
quotes[4] = "Have a Midas touch<br></b>- <i>Be very successful with money";
quotes[5] = "To get the message<br></b>- <i>To understand what somebody means";
quotes[6] = "A meat and potatoes man<br></b>- <i>A person who likes to deal with the basic aspects of something";
quotes[7] = "To mean well<br></b>- <i>To have the best intentions";
quotes[8] = "To go overboard<br></b>- <i>to be excited and enthusiastic about something";
quotes[9] = "Everything went like clockwork<br></b>- <i>Everything went according to plan";
quotes[10] = "On the make<br></b>- <i>Trying openly to be successful";
quotes[11] = "To have it made<br></b>- <i>To be sure of success";
quotes[12] = "To understand something loud and clear<br></b>- <i>To get the message comepletely";
quotes[13] = "To hit the headlines<br></b>- <i>To make news so that people are talking about you";
quotes[14] = "To let your hair down<br></b>- <i>To relax and not to worry about the consequences";
quotes[15] = "To be at a loss<br></b>- <i>To be uncertain about what to do or how to do it";
quotes[16] = "To look down in the mouth<br></b>- <i>To look depressed";
quotes[17] = "To have your lips sealed<br></b>- <i>To keep a secret";
quotes[18] = "A flash in the pan<br></b>- <i>A success which will not last long and is unlikely to be repeated";
quotes[19] = "To make a mountain out of a molehill<br></b>- <i>To make a situation appear much more serious than it is";
quotes[20] = "To know a place like the back of your hand<br></b>- <i>To know a place very well";
quotes[21] = "Out of sight, out of mind<br></b>- <i>If I cannot see it, I do not have to admit it is real!";
quotes[22] = "A Marked person<br></b>- <i>Someone who is in danger of something about to happen";
quotes[23] = "Live and let live<br></b>- <i>To accept others' opions and behaviours";
quotes[24] = "To hit the roof<br></b>- <i>To overreact to a situation";
quotes[25] = "To take with a grain of salt<br></b>- <i>to give no importance to : not to believe what you hear";
quotes[26] = "A lost cause<br></b>- <i>A situation or ambition which is bound to fail";
quotes[27] = "To be on the safe side<br></b>- <i>To not take any risks";
quotes[28] = "To lose your bearings<br></b>- <i>To become lost";
quotes[29] = "To be a dark horse<br></b>- <i>A person who hides their plans or their feelings";
quotes[30] = "A long shot<br></b>- <i>To make a guess which you are not very confident is right";
quotes[31] = "Not for love or money<br></b>- <i>Something which is totally impossible to be done";
document.write('<font size="2" color="#008000"><b>' + textdate + '</b></font><br>')
document.write('<b>' + quotes[day] + '</i><br>');
// End -->
</script> Again, everything between <script> and </script> into a fresh Notepad doc and save it as quote.js. Then where that was: <script src="quote.js" type="text/javascript" language="JavaScript"></script> I can't guarantee that one will work though. Do you want me to neaten up the Nav coding as well? Dan
_____________________________
|
|
|
|
CelticDragon
Posts: 227 Joined: 11/14/2003 From: Dublin, Ireland Status: offline
|
RE: Removing Javascript - 9/13/2004 7:06:20
changed the code and now it's giving me problems! it says there's a Script error... I have all my bits stored in different folders, is this going to cause a problem? Should I upload the js file and hard code the source?
_____________________________
I Lost My Stuff - If you lost it, someone found it!
|
|
|
|
Giomanach
Posts: 6090 Joined: 11/19/2003 From: England Status: offline
|
RE: Removing Javascript - 9/13/2004 7:09:32
For the page given, you should have the homepage file and the JavaScript files in the same directory. index.htm, quote.js, imagechange.js should all be in the same directory. Upload the altered files to a new directory, JS et al, and lemme have a look Dan
_____________________________
|
|
|
|
CelticDragon
Posts: 227 Joined: 11/14/2003 From: Dublin, Ireland Status: offline
|
RE: Removing Javascript - 9/13/2004 7:10:59
well, this site is live at the moment with a lot of visitors... don't want to have problems uploaded before I have them sorted
_____________________________
I Lost My Stuff - If you lost it, someone found it!
|
|
|
|
Giomanach
Posts: 6090 Joined: 11/19/2003 From: England Status: offline
|
RE: Removing Javascript - 9/13/2004 7:12:11
Put the new files in a different directory, not the site directory...create a new one and put them in there Dan
_____________________________
|
|
|
|
CelticDragon
Posts: 227 Joined: 11/14/2003 From: Dublin, Ireland Status: offline
|
RE: Removing Javascript - 9/13/2004 7:15:31
I previewed in my browser and took the source code.... I'll delete this if it's too much EDIT: Code Deleted!
< Message edited by CelticDragon -- 9/13/2004 7:33:04 >
_____________________________
I Lost My Stuff - If you lost it, someone found it!
|
|
|
|
Giomanach
Posts: 6090 Joined: 11/19/2003 From: England Status: offline
|
RE: Removing Javascript - 9/13/2004 7:18:12
<Script Language='JavaScript'>
<script src="imagechange.js" type="text/javascript" language="JavaScript"></script>
</script>
Remoof <Script Language='JavaScript'> & the last </script>
_____________________________
|
|
|
|
CelticDragon
Posts: 227 Joined: 11/14/2003 From: Dublin, Ireland Status: offline
|
RE: Removing Javascript - 9/13/2004 7:23:27
done... still not showing the pics and saying there is an error in line 40 now... EDIT: Just realised that the page calls for show image() but I can't find that anywhere else....
_____________________________
I Lost My Stuff - If you lost it, someone found it!
|
|
|
|
Giomanach
Posts: 6090 Joined: 11/19/2003 From: England Status: offline
|
RE: Removing Javascript - 9/13/2004 7:26:27
Ok...that's one of the ones you can't have in an external file...no fair...put the coding back in, remove the src attribute from the <script> tag, and put the JS back in between the two <script> tags. Then Try the quote one. The main bulk here is your Nav bar....It can be replaced with simple CSS one that will look exactly the same. Dan
_____________________________
|
|
|
|
Giomanach
Posts: 6090 Joined: 11/19/2003 From: England Status: offline
|
RE: Removing Javascript - 9/13/2004 7:38:42
quote:
EDIT: Just realised that the page calls for show image() but I can't find that anywhere else.... That's b'cos you've moved it to the external JS file...or had This is a bit of a bugger...both scripts have to be used as internal JS Programs.... The Nav bar may be done by FP, but it does bloat the coding. Yeah I know it makes it easier to maintain. I'd recode the page for you, but I'm pretty tied up with my own work... It's not down to choice of JS programs...it's the way they've been coded, so don't blame yourself on this one. The JS is the main bulk of the page, but unfortunatley, it looks like it's the way its gonna stay Dan
_____________________________
|
|
|
|
Giomanach
Posts: 6090 Joined: 11/19/2003 From: England Status: offline
|
RE: Removing Javascript - 9/13/2004 7:40:36
quote:
EDIT: PS: I want to get rid of our splash page which is set up on www.alphacollege.com and leads to www.alphacollege.com/site..... do I just republish the site to www.alphacollege.com or are there sections of the web that will get messed up? Delete index.htm or whatever the page is, rename home.htm to index.htm and recalculate links, it shouldn't cause any problems, then re-publish to the server via FP Dan
_____________________________
|
|
|
|
CelticDragon
Posts: 227 Joined: 11/14/2003 From: Dublin, Ireland Status: offline
|
RE: Removing Javascript - 9/13/2004 7:48:09
Dan, Sorry, I didn't get that bit.... rename the /site bit as /site/home.htm and as the main index page too?
_____________________________
I Lost My Stuff - If you lost it, someone found it!
|
|
|
|
Giomanach
Posts: 6090 Joined: 11/19/2003 From: England Status: offline
|
RE: Removing Javascript - 9/13/2004 7:51:38
You can remove the current home page under the web root (wwwroot or public_html, dependant on your server type), and then rename home.htm to index.htm, recalculate you hyperlinks, and then you can publish the content of the site direcotry to your root directory. Directory Structure: -Web Root ---HomePage <delete -----/site --------home.htm <<rename to index.htm Publish the content of /site to the Web Root, make sense? Dan
_____________________________
|
|
|
|
CelticDragon
Posts: 227 Joined: 11/14/2003 From: Dublin, Ireland Status: offline
|
RE: Removing Javascript - 9/13/2004 8:21:26
gotcha... but I have /site set up as a sub web, is it just as easy to publish the /site bit to the main folder?
_____________________________
I Lost My Stuff - If you lost it, someone found it!
|
|
|
|
Giomanach
Posts: 6090 Joined: 11/19/2003 From: England Status: offline
|
RE: Removing Javascript - 9/13/2004 8:25:58
Would be easier to create a new web within FP for that, just import the files over. Again, shouldn't cause any problem, just ensure you recalculate links before you publish Dan
_____________________________
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|