|
| |
|
|
UrbanGrafix
Posts: 10 Joined: 4/25/2007 Status: offline
|
Javascript problem in a .dwt - 4/25/2007 0:42:35
Ok im trying to get a rotating banner at te top of my page working but my problem is that if the script is in the body the .dwt ignores it so I need to get it in the head tag only problem is that the actual place I need it to work is in the body tag and i have no clues on what to do. Below is the java code im using and the webpages code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="SHORTCUT ICON" href="images/lolo.ico"/>
<title>St Joseph's School, Morrinsville</title>
<!-- #BeginEditable "doctitle" -->
<!-- #EndEditable -->
<link href="styles/style3.css" rel="stylesheet" type="text/css" />
<meta name="description" content="St Joseph's School Morrinsville - Morrinsville's only Catholic learning environment." />
</head>
<body style="background-color: #FFFFFF; background-image: url('images/background1.jpg');">
<p class="style2"> </p>
<!-- Begin Container -->
<a name="top" id="top"></a>
<div id="container">
<!-- Begin Masthead -->
<div id="masthead" class="style2">
<script src="slideshow.js" language="javascript" type="text/javascript"></script>
</div>
<!-- End Masthead -->
<!-- Begin Page Content -->
<div id="page_content" class="float_right">
<!-- Begin Sidebar -->
<div id="sidebar" style="left: -5px; top: 23px" class="style15">
<a href="default.htm" style="width: 99px; height: 10px; color:navy">
Home</a>
<a href="welcome/welcome.htm" style="width: 146px; height: 10px; color:navy">Principal's Welcome</a>
<a href="trustees/trustees.htm" style="width: 136px; height: 10px; color:navy">Board of Trustees</a>
<a href="about/about.htm" style="width: 67px; height: 10px; color:navy">About Us</a>
<a href="newsletter/newsletter.htm" style="width: 118px; height: 10px; color:navy">Our Newsletter</a>
<a href="staff/staff.htm" style="width: 66px; height: 10px; color:navy">Our Staff</a>
<a href="classrooms/classrooms.htm" style="width: 119px; height: 10px; color:navy">Our Classrooms</a>
<a href="contact/contact.htm" style="width: 80px; height: 10px; color:navy">Contact Us</a>
<a href="parish/parish.htm" style="width: 80px; height: 10px; color:navy">The Parish</a>
</div>
<!-- End Sidebar -->
<!-- Begin Content -->
<div id="content" style="left: -5px; top: 0px; width: 423px;">
<!-- #BeginEditable "content" -->
<h2 class="style14">Headline 2</h2>
<p class="style15">insert content here</p>
<p class="style15"> </p>
<p class="style15"> </p>
<p class="style15"> </p>
<p class="style15"> </p>
<p class="style15"> </p>
<p class="style15"> </p>
<!-- #EndEditable --></div>
<!-- End Content --></div>
<!-- End Page Content -->
<!-- Begin Footer -->
<div id="footer">
<p>
<a href="#top" ><span class="style17"> ^ Top of Page</span></a> |
<a href="default.htm" class="style16">Home</a> |
<a href="welcome/welcome.htm" class="style16">Principal's Welcomes</a> |
<a href="trustees/trustees.htm" class="style16">Trustees</a> |
<a href="about/about.htm" class="style16">About Us</a> |
<a href="newsletter/newsletter.htm" class="style16">Newsletter</a> |
<a href="staff/staff.htm" class="style16">Staff</a> |
<a href="classrooms/classrooms.htm" class="style16">Students</a> |
<a href="contact/contact.htm" class="style16">Contact</a>
</p>
<p><span class="style17">
Copyright © 2007 St. Joseph's Morrinsville All Rights Reserved.
</span></p>
</div>
<!-- End Footer -->
<!-- End Container -->
</div>
</body>
</html>
and the js file itself function random_imglink(){
var myimages=new Array()
//specify random images below. You can have as many as you wish
myimages[1]="images/faded_end logo.jpg"
myimages[2]="images/faded_end logo1.jpg"
myimages[3]="images/faded_end logo2.jpg"
var ry=Math.floor(Math.random()*myimages.length)
if (ry==0)
ry=1
document.write('<img src="'+myimages[ry]+'" border=0>')
}
random_imglink()
|
|
|
|
coreybryant
Posts: 2480 Joined: 3/17/2002 From: Castle Rock CO USA Status: online
|
RE: Javascript problem in a .dwt - 4/25/2007 11:56:54
Try using virtual links in everything to see if that solves the problem <script src="/slideshow.js" language="javascript" type="text/javascript"></script> and myimages[1]="/images/faded_end logo.jpg"
_____________________________
Corey R. Bryant Merchant Accounts | Toll Free Numbers | Expression Web Blog
|
|
|
|
UrbanGrafix
Posts: 10 Joined: 4/25/2007 Status: offline
|
RE: Javascript problem in a .dwt - 4/25/2007 15:30:58
The Top code works fine bit if I add in the second lot of code for the body it does not recognize it as it has nothing calling it eg <Script>
|
|
|
|
Tailslide
Posts: 6272 Joined: 5/10/2005 From: Out here on the raggedy edge Status: offline
|
RE: Javascript problem in a .dwt - 4/26/2007 2:25:09
The second bit of code was Corey showing you what you need to change in the Javascript file itself - i.e. you need to add the "/" before "images" to ensure it works from anywhere on the site.
_____________________________
"My strategy is so simple an idiot could have devised it" Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project
|
|
|
|
UrbanGrafix
Posts: 10 Joined: 4/25/2007 Status: offline
|
RE: Javascript problem in a .dwt - 4/26/2007 3:31:43
Ok Thanks, But then whats calling the script where I need it? (or am I just thick lol)
|
|
|
|
UrbanGrafix
Posts: 10 Joined: 4/25/2007 Status: offline
|
RE: Javascript problem in a .dwt - 4/27/2007 2:44:42
bump
|
|
|
|
coreybryant
Posts: 2480 Joined: 3/17/2002 From: Castle Rock CO USA Status: online
|
RE: Javascript problem in a .dwt - 4/27/2007 11:56:40
Wouldn't this be calling the JS files <script src="slideshow.js" language="javascript" type="text/javascript"></script>
_____________________________
Corey R. Bryant Merchant Accounts | Toll Free Numbers | Expression Web Blog
|
|
|
|
UrbanGrafix
Posts: 10 Joined: 4/25/2007 Status: offline
|
RE: Javascript problem in a .dwt - 4/27/2007 14:49:57
If its is then its not working. As nothing is happening I mean before since I had the script in the body tags it only worked on the home page and then the rest of the pages didnt show it. Basically i read up on it and it says I cant have any script in the body tags so ive done this. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="SHORTCUT ICON" href="images/lolo.ico"/>
<title>St Joseph's School, Morrinsville</title>
<!-- #BeginEditable "doctitle" -->
<!-- #EndEditable -->
<link href="styles/style3.css" rel="stylesheet" type="text/css" />
<script src="/slideshow.js" language="javascript" type="text/javascript"></script>
<meta name="description" content="St Joseph's School Morrinsville - Morrinsville's only Catholic learning environment." />
</head>
<body style="background-color: #FFFFFF; background-image: url('images/background1.jpg');">
<p class="style2"> </p>
<!-- Begin Container -->
<a name="top" id="top"></a>
<div id="container">
<!-- Begin Masthead -->
<div id="masthead" class="style2">
<img src="images/faded_end logo.jpg" alt="" width="630" height="115" /></div>
<!-- End Masthead -->
<!-- Begin Page Content -->
<div id="page_content" class="float_right">
<!-- Begin Sidebar -->
<div id="sidebar" style="left: -5px; top: 23px" class="style15">
<a href="default.htm" style="width: 99px; height: 10px; color:navy">
Home</a>
<a href="welcome/welcome.htm" style="width: 146px; height: 10px; color:navy">Principal's Welcome</a>
<a href="trustees/trustees.htm" style="width: 136px; height: 10px; color:navy">Board of Trustees</a>
<a href="about/about.htm" style="width: 67px; height: 10px; color:navy">About Us</a>
<a href="newsletter/newsletter.htm" style="width: 118px; height: 10px; color:navy">Our Newsletter</a>
<a href="staff/staff.htm" style="width: 66px; height: 10px; color:navy">Our Staff</a>
<a href="classrooms/classrooms.htm" style="width: 119px; height: 10px; color:navy">Our Classrooms</a>
<a href="contact/contact.htm" style="width: 80px; height: 10px; color:navy">Contact Us</a>
<a href="parish/parish.htm" style="width: 80px; height: 10px; color:navy">The Parish</a>
</div>
<!-- End Sidebar -->
<!-- Begin Content -->
<div id="content" style="left: -5px; top: 0px; width: 423px;">
<!-- #BeginEditable "content" -->
<h2 class="style14">Headline 2</h2>
<p class="style15">insert content here</p>
<p class="style15"> </p>
<p class="style15"> </p>
<p class="style15"> </p>
<p class="style15"> </p>
<p class="style15"> </p>
<p class="style15"> </p>
<!-- #EndEditable --></div>
<!-- End Content --></div>
<!-- End Page Content -->
<!-- Begin Footer -->
<div id="footer">
<p>
<a href="#top" ><span class="style17"> ^ Top of Page</span></a> |
<a href="default.htm" class="style16">Home</a> |
<a href="welcome/welcome.htm" class="style16">Welcome</a> |
<a href="trustees/trustees.htm" class="style16">Trustees</a> |
<a href="about/about.htm" class="style16">About Us</a> |
<a href="newsletter/newsletter.htm" class="style16">Newsletter</a> |
<a href="staff/staff.htm" class="style16">Staff</a> |
<a href="classrooms/classrooms.htm" class="style16">Students</a> |
<a href="contact/contact.htm" class="style16">Contact</a> |
<a href="parish/parish.htm" class="style16">Parish</a>
</p>
<p><span class="style17">
Copyright © 2007 St. Joseph's Morrinsville All Rights Reserved.
</span> - <span class="style17">
<a href="mailto:Oceanearth15@Hotmail.com?subject=St Joes Website">Created by A.Young
</a>
</span></p>
</div>
<!-- End Footer -->
<!-- End Container -->
</div>
</body>
</html>
Where the code <img src="images/faded_end logo.jpg" alt="" width="630" height="115" /> is then I need somthing to like make the script work there if you get what I mean so the scripting is kept in the head tag
|
|
|
|
coreybryant
Posts: 2480 Joined: 3/17/2002 From: Castle Rock CO USA Status: online
|
RE: Javascript problem in a .dwt - 4/27/2007 15:20:15
Do you have an example online perhaps?
_____________________________
Corey R. Bryant Merchant Accounts | Toll Free Numbers | Expression Web Blog
|
|
|
|
UrbanGrafix
Posts: 10 Joined: 4/25/2007 Status: offline
|
RE: Javascript problem in a .dwt - 4/27/2007 15:58:36
ummm lol not really I just want it to work. Basically the js file rotates an image on page refresh the the .dwt wont alow me to have scripts in the body so basically im wanting to know if there anyway to have let say the scripting itself in the head but kinda like its hidden but in the body where I want the image somehoe not using a scrip - or i could try to see if its works using one but i doubt it. Put somthing there which kind of activates the script in that place on the page
|
|
|
|
coreybryant
Posts: 2480 Joined: 3/17/2002 From: Castle Rock CO USA Status: online
|
RE: Javascript problem in a .dwt - 4/27/2007 16:55:22
I don't see a reason why the DWT would not allow you to have the JS in the body. Have you tried using the script written out instead of including it?
_____________________________
Corey R. Bryant Merchant Accounts | Toll Free Numbers | Expression Web Blog
|
|
|
|
UrbanGrafix
Posts: 10 Joined: 4/25/2007 Status: offline
|
RE: Javascript problem in a .dwt - 4/27/2007 19:40:43
im sorry im only a layman and not very knowledgable what do you mean by "written out" also it wont alow a script in the body somthing to do with the body is used for creating new pages etc. But if u mean take away the .js file and include the script in the site yea thats what I tried first and its works but only on the home page. And then all the other pages have no banner on them
|
|
|
|
coreybryant
Posts: 2480 Joined: 3/17/2002 From: Castle Rock CO USA Status: online
|
RE: Javascript problem in a .dwt - 4/28/2007 7:18:09
How are you testing these pages? You are viewing them in a browser? If locally - you might have some problems because of security
_____________________________
Corey R. Bryant Merchant Accounts | Toll Free Numbers | Expression Web Blog
|
|
|
|
UrbanGrafix
Posts: 10 Joined: 4/25/2007 Status: offline
|
RE: Javascript problem in a .dwt - 4/28/2007 14:43:25
Yes im using Expression Web and testing them using the preview feature and also got it hosted on a free site for testing also
|
|
|
|
coreybryant
Posts: 2480 Joined: 3/17/2002 From: Castle Rock CO USA Status: online
|
RE: Javascript problem in a .dwt - 4/28/2007 16:40:07
On the free server, do you have the URL? Chances are pretty good it won't show up via Expression Web. And on the free site, do they add any JS that might be conflicting with your JavaScript?
_____________________________
Corey R. Bryant Merchant Accounts | Toll Free Numbers | Expression Web Blog
|
|
|
|
UrbanGrafix
Posts: 10 Joined: 4/25/2007 Status: offline
|
RE: Javascript problem in a .dwt - 4/28/2007 17:18:33
http://andyou88.100webspace.net/ - the homepage has the script on it and it works the only other page ive updated with the script is the principals welcome page and as shown there it wont display any banner
|
|
|
|
coreybryant
Posts: 2480 Joined: 3/17/2002 From: Castle Rock CO USA Status: online
|
RE: Javascript problem in a .dwt - 4/29/2007 8:35:29
When you go to the Principal page, you have a folder in there (welcome) and in the script you used: function random_imglink(){
var myimages=new Array()
//specify random images below. You can have as many as you wish
myimages[1]="images/faded_end logo.jpg"
myimages[2]="images/faded_end logo1.jpg"
myimages[3]="images/faded_end logo2.jpg"
var ry=Math.floor(Math.random()*myimages.length)
if (ry==0)
ry=1
document.write('<img src="'+myimages[ry]+'" border=0>')
}
random_imglink()Your paths are incorrect. Your paths are looking at welcome/images/ not images. You need to use virtual links as I recommended earlier myimages[1]="/images/faded_end logo.jpg" so that the root would be pushed back to the root
_____________________________
Corey R. Bryant Merchant Accounts | Toll Free Numbers | Expression Web Blog
|
|
|
|
UrbanGrafix
Posts: 10 Joined: 4/25/2007 Status: offline
|
RE: Javascript problem in a .dwt - 5/2/2007 1:04:05
LOL. I tried tht in Expression and it didnt work but now it works FFS im dumb lol thanks ALOT
|
|
|
|
coreybryant
Posts: 2480 Joined: 3/17/2002 From: Castle Rock CO USA Status: online
|
RE: Javascript problem in a .dwt - 5/2/2007 6:59:32
Just glad it is all working now. Good luck with the site!
_____________________________
Corey R. Bryant Merchant Accounts | Toll Free Numbers | Expression Web Blog
|
|
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
|
|
|