Hi - sorry if this is posted in an inappropriate place!coulnt find where to post it.
I am using 2 java acripts on one page. When testing they both work fine in Firefox but only one works in IE. If i take the second out the first then works in IE. Heres my code so you can get an idea of what im talking about.
The first script is so the horzontal menus work correctly in a range of browsers. drop_down.js .
The second is a scrolling news script. scrollnews.js
here's the script for the scroll news im not sure if you need it?
Thanks im sure its simple but i have little knowledge in working with java script
Thanks
Ben
I am using 2 java acripts on one page. When testing they both work fine in Firefox but only one works in IE. If i take the second out the first then works in IE. Heres my code so you can get an idea of what im talking about.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
[COLOR=red]<script src="includes/drop_down.js"></script>[/color red]
<link href="styles/wp_style.css" rel="stylesheet" type="text/css">
<link href="styles/nav_style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="header">
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="616" height="83"><img src="images_new/header/new-design_01.gif" width="58" height="79"><img src="images_new/header/new-design_02.gif" width="558" height="79"></td>
<td width="164" align="right"><img src="images_new/header/new-design_03.jpg" width="164" height="79"></td>
</tr>
</table>
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="5" height="19" align="left"><img src="images_new/header/scroll.gif" width="5" height="10"></td>
<td width="614" align="left">[COLOR=red]<script src="scrollnews.js"></script>[/color red]</td>
<td width="10" align="left"><img src="images_new/header/scrollr.gif" width="5" height="10"></td>
<td width="156" valign="middle"> <? echo "<p class='date'>" . date('D F j Y') . "</p>";?>
</td>
</tr>
</table>
</div>
<div style="text-align: center;">
<div id="body">
<div id="navigation">
<ul id="nav">
<li><a href="index.php">Home</a></li>
<li><a href="#">Coaching Tools</a>
<ul>
<li><a href="evaluation_session.php">Client Evaluation</a></li>
<li><a href="step1.php">Step 1</a></li>
<li><a href="step2.php">Step 2</a></li>
<li><a href="step3.php">Step 3</a></li>
<li><a href="step4.php">Step 4</a></li>
<li><a href="step5.php">Step 5</a></li>
<li><a href="step6.php">Step 6</a></li>
<li><a href="step7.php">Step 7</a></li>
<li><a href="step8.php">Step 8</a></li>
<li><a href="step9.php">Step 9</a></li>
<li><a href="step10.php">Step 10</a></li>
<li><a href="step11.php">Step 11</a></li>
<li><a href="step12.php">Step 12</a></li>
</ul>
</li>
<li><a href="#">Message Board</a> </li>
<li><a href="contact.php">Contact Support</a> </li>
<li><a href="log_out.php">Log out</a> </li>
</ul></div>
</div>
</div>
</body>
</html>
The first script is so the horzontal menus work correctly in a range of browsers. drop_down.js .
The second is a scrolling news script. scrollnews.js
here's the script for the scroll news im not sure if you need it?
Code:
/*
Cross browser Marquee script- © Dynamic Drive ([URL unfurl="true"]www.dynamicdrive.com)[/URL]
For full source code, 100's more DHTML scripts, and Terms Of Use, visit [URL unfurl="true"]http://www.dynamicdrive.com[/URL]
Credit MUST stay intact
*/
//Specify the marquee's width (in pixels)
var marqueewidth="620px"
//Specify the marquee's height
var marqueeheight="15px"
//Specify the marquee's marquee speed (larger is faster 1-10)
var marqueespeed=1
//configure background color:
var marqueebgcolor="#FFFFFF"
//Pause marquee onMousever (0=no. 1=yes)?
var pauseit=1
//Specify the marquee's content (don't delete <nobr> tag)
//Keep all content on ONE line, and backslash any single quotations (ie: that\'s great):
var marqueecontent='<nobr><font face="Arial" font color="666666" font size="1px"><strong>Welcome to W&P Assessment and Training Centre <a href="news.htm" style="text-decoration: none font-family: Arial, Helvetica, sans-serif; font-size: 11px;font-weight: normal; color: #007ba4;">Click Here</a> Latest News <a href="news.htm">Click Here</a> Latest News <a href="news.htm">Click Here</a> Latest News <a href="news.htm">Click Here</a> Latest News <a href="news.htm">Click Here</a> Latest News <a href="news.htm">Click Here</a> Latest News <a href="news.htm">Click Here</a> Latest News <a href="news.htm">Click Here</a> Latest News <a href="news.htm">Click Here</a> Latest News <a href="news.htm">Click Here</a> Latest News <a href="news.htm">Click Here</a> Latest New<a href="news.htm">Click Here</a></FONT></nobr>'
////NO NEED TO EDIT BELOW THIS LINE////////////
marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1) //slow speed down by 1 for NS
var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+marqueecontent+'</span>')
var actualwidth=''
var cross_marquee, ns_marquee
function populate(){
if (iedom){
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
cross_marquee.innerHTML=marqueecontent
actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth
}
else if (document.layers){
ns_marquee=document.ns_marquee.document.ns_marquee2
ns_marquee.left=parseInt(marqueewidth)+8
ns_marquee.document.write(marqueecontent)
ns_marquee.document.close()
actualwidth=ns_marquee.document.width
}
lefttime=setInterval("scrollmarquee()",20)
}
window.onload=populate
function scrollmarquee(){
if (iedom){
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px"
else
cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
}
else if (document.layers){
if (ns_marquee.left>(actualwidth*(-1)+8))
ns_marquee.left-=copyspeed
else
ns_marquee.left=parseInt(marqueewidth)+8
}
}
if (iedom||document.layers){
with (document){
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
if (iedom){
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
write('<div id="iemarquee" style="position:absolute;left:0px;top:0px"></div>')
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
write('</ilayer>')
}
document.write('</td></table>')
}
}
Thanks im sure its simple but i have little knowledge in working with java script
Thanks
Ben