By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,507 Members | 1,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,507 IT Pros & Developers. It's quick & easy.

include a javascript disable the function of another

P: 10
Hi guys

I have 2 javascript functions, First I include which does swap images whenever I pass the mouse over a certain image

Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript" type="text/JavaScript" src="includes/MapScript.js"></script>
  2.  
then I wanted to include another function inside a table <td> tag that moves text in a way similar to marquee.

Expand|Select|Wrap|Line Numbers
  1. <td> 
  2. <script language="JavaScript" type="text/JavaScript" src="includes/ScrollText.js"></script> </td>
  3.  
Note that the swap image functions are used later in the table.

The problem is when ever I add the ScrollText.js the Swaping of images is disabled, as if ScrollText stoped MapScript from functioning

Any help?
Jul 24 '07 #1
Share this Question
Share on Google+
4 Replies


epots9
Expert 100+
P: 1,351
Hi guys

I have 2 javascript functions, First I include which does swap images whenever I pass the mouse over a certain image

Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript" type="text/JavaScript" src="includes/MapScript.js"></script>
  2.  
then I wanted to include another function inside a table <td> tag that moves text in a way similar to marquee.

Expand|Select|Wrap|Line Numbers
  1. <td> 
  2. <script language="JavaScript" type="text/JavaScript" src="includes/ScrollText.js"></script> </td>
  3.  
Note that the swap image functions are used later in the table.

The problem is when ever I add the ScrollText.js the Swaping of images is disabled, as if ScrollText stoped MapScript from functioning

Any help?
please post your javascript function(s) and the the html that calls these functions.

thank you
Jul 24 '07 #2

P: 10
Ok
First is the HorizontalScoller.js file (I called it in my previous post as Scrolltext)

Expand|Select|Wrap|Line Numbers
  1. var marqueewidth="770px"
  2. var marqueeheight="30px"
  3. var marqueespeed=1
  4. var marqueebgcolor= "#F8FBD0" 
  5. var pauseit=1
  6.  
  7. var marqueecontent='<nobr><font size=2 color="#A05048" face="Arial"><b>Nos Bureau Sont Ouvert Du Lundi au Vendredi</b></font></nobr>'
  8.  
  9. marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1) //slow speed down by 1 for NS
  10. var copyspeed=marqueespeed
  11. var pausespeed=(pauseit==0)? copyspeed: 0
  12. var iedom=document.all||document.getElementById
  13. if (iedom)
  14. document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+marqueecontent+'</span>')
  15. var actualwidth=''
  16. var cross_marquee, ns_marquee
  17.  
  18. function populate(){
  19. if (iedom){
  20. cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  21. cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
  22. cross_marquee.innerHTML=marqueecontent
  23. actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth
  24. }
  25. else if (document.layers){
  26. ns_marquee=document.ns_marquee.document.ns_marquee2
  27. ns_marquee.left=parseInt(marqueewidth)+8
  28. ns_marquee.document.write(marqueecontent)
  29. ns_marquee.document.close()
  30. actualwidth=ns_marquee.document.width
  31. }
  32. lefttime=setInterval("scrollmarquee()",20)
  33. }
  34. window.onload=populate
  35.  
  36. function scrollmarquee(){
  37. if (iedom){
  38. if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
  39. cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px"
  40. else
  41. cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
  42.  
  43. }
  44. else if (document.layers){
  45. if (ns_marquee.left>(actualwidth*(-1)+8))
  46. ns_marquee.left-=copyspeed
  47. else
  48. ns_marquee.left=parseInt(marqueewidth)+8
  49. }
  50. }
  51.  
  52. if (iedom||document.layers){
  53. with (document){
  54. document.write('<table align="center" border="0" cellspacing="0" cellpadding="0"><td>')
  55. if (iedom){
  56. write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  57. write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  58. write('<div id="iemarquee" style="position:absolute;left:0px;top:0px"></div>')
  59. write('</div></div>')
  60. }
  61. else if (document.layers){
  62. write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  63. write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  64. write('</ilayer>')
  65. }
  66. document.write('</td></table>')
  67. }
  68. }
  69.  
then the other function MapScript.js
Expand|Select|Wrap|Line Numbers
  1. //*********************************************************************************
  2. //
  3. //*********************************************************************************
  4. function PreloadImages(){
  5.     Image1 = new Image(210,251)
  6.     Image1.src = "images/map.gif"
  7.  
  8.     Image2 = new Image(210,251)
  9.     Image2.src = "images/northon.gif"
  10.  
  11.     Image3 = new Image(210,251)
  12.     Image3.src = "images/southon.gif"
  13.  
  14.     Image4 = new Image(210,251)
  15.     Image4.src = "images/mlon.gif"
  16.  
  17.     Image5 = new Image(210,251)
  18.     Image5.src = "images/beiruton.gif" 
  19.  
  20.     Image6 = new Image(210,251)
  21.     Image6.src = "images/bekaa1on.gif" 
  22. }
  23.  
  24. //*********************************************************************************
  25. //
  26. //*********************************************************************************
  27. function original() {
  28. target= document.getElementById("MyMap");
  29. target.style.filter="blendTrans(duration=1)"
  30. target.filters[0].Apply();  // apply the filter
  31. target.filters[0].Play();   // play the filter
  32. document.images.MyMap.src = Image1.src; return true; 
  33. }
  34.  
  35. function SwapNorthOn() {
  36. target= document.getElementById("MyMap");
  37. target.style.filter="blendTrans(duration=1)"
  38. target.filters[0].Apply();  // apply the filter
  39. target.filters[0].Play();   // play the filter
  40. document.images.MyMap.src = Image2.src; return true;
  41. }
  42.  
  43. function SwapSouthOn() {
  44. target= document.getElementById("MyMap");
  45. target.style.filter="blendTrans(duration=1)"
  46. target.filters[0].Apply();  // apply the filter
  47. target.filters[0].Play();   // play the filter
  48. document.images.MyMap.src = Image3.src; return true;
  49. }
  50.  
  51. function SwapMLOn() {
  52. target= document.getElementById("MyMap");
  53. target.style.filter="blendTrans(duration=1)"
  54. target.filters[0].Apply();  // apply the filter
  55. target.filters[0].Play();   // play the filter
  56. document.images.MyMap.src = Image4.src; return true;
  57. }
  58.  
  59. function SwapBeirutOn() {
  60. target= document.getElementById("MyMap");
  61. target.style.filter="blendTrans(duration=1)"
  62. target.filters[0].Apply();  // apply the filter
  63. target.filters[0].Play();   // play the filter
  64. document.images.MyMap.src = Image5.src; return true;
  65. }
  66.  
  67. function SwapBekaaOn() {
  68. target= document.getElementById("MyMap");
  69. target.style.filter="blendTrans(duration=1)"
  70. target.filters[0].Apply();  // apply the filter
  71. target.filters[0].Play();   // play the filter
  72. document.images.MyMap.src = Image6.src; return true;
  73. }
  74.  
  75.  
  76. //
  77. //
  78. //
  79. var myLinks = [
  80. "http://www.google.com", "http://www.yahoo.com",
  81. "http://www.altavista.com", "http://www.microsoft.com", "http://www.yahoo.fr"];
  82. var myCaption = ["Les Facultés à Tripoli","Les Facultés au Mont Liban",
  83.                  "Les Facultés à Beyrouth","Les Facultés Sud","Les Facultés au Bekaa"]
  84. var myTexts = [
  85. "<b><font color=#A75D3C>Faculte de droit, Tripoli<br>Faculte des sciences, Tripoli <br>Faculte de medecine, Tripoli</font></b>",
  86. "<b><font color=#A75D3C>Faculte de droit, Mont Liban <br>Faculte des sciences, Mont Liban <br>Faculte de medecine, Mont Liban</font></b>",
  87. "<b><font color=#A75D3C>Faculte de droit Beyrouth <br>Faculte des sciences, Beyrouth <br>Faculte de medecine, Beyrouth</font></b>", 
  88. "<b><font color=#A75D3C>Faculte de droit South <br>Faculte des sciences, South <br>Faculte de medecine, South</font></b>", 
  89. "<b><font color=#A75D3C>Faculte de droit Bekaa <br>Faculte des sciences, Bekaa <br>Faculte de medecine, Bekaa</font></b>", 
  90. ];
  91. var k = 0;
  92.  
  93. function chgLink(x)
  94. {
  95. var el = document2.getElementById(1);
  96. el.innerHTML = myTexts[x]; 
  97. el.title = myCaption[x];
  98. el.href = myLinks[x];
  99.  
  100. }
  101.  
  102.  
then the HTML that calls them:
Expand|Select|Wrap|Line Numbers
  1. :
  2. <html>
  3. <head>
  4. .... 
  5. <script language="JavaScript" type="text/JavaScript" src="includes/MapScript.js"></script>
  6. </head>
  7. <body onLoad="PreloadImages();" bgcolor="#F8FBD0">
  8.  
  9. <table cellpadding="0" cellspacing="0" width="100%" height="100%" border="0">
  10.     <tr>
  11. <td valign="top">
  12. <center>
  13.             <table cellpadding="0" cellspacing="0" width="765" height="100%" border="0">
  14.                 <tr>
  15.                     <td valign="top">
  16.                         <table cellpadding="0" cellspacing="0" width="765" border="0" ID="Table1">
  17.                             <tr>
  18.                             ...                            </tr>
  19.                         </table>
  20.                                                 <table cellpadding="0" cellspacing="0" width="765" border="0" ID="Table11">
  21.                             <tr>
  22.  <td valign="top" align="center">
  23. <script language="JavaScript" type="text/JavaScript" src="includes/HorizontalScroller.js"></script> 
  24. </td>
  25. ....                                    <script type='text/javascript' src='includes/exmplmenu2_var.js'></script></td>
  26.                                 <td>
  27.                                     <script type='text/javascript' src='includes/menu_com.js'></script>
  28.                                 </td>
  29.                                 <td>
  30.                                     <noscript>Votre naviguateur ne supporte pas les scripts</noscript>
  31.                                 </td>
  32.                             </tr>
  33.                         </table>
  34.                         <table cellpadding="0" cellspacing="0" width="100%" border="0" ID="Table3" style="margin-top:90px;">
  35.                             <tr>
  36.                                 <td  align="center" valign = top width="40%">
  37.                                     <font color="#A75D3C">.....</b><br>
  38. ....
  39.         <img id="MyMap" src="images/map.gif" border="0" width="210" height="251" usemap="#ahmad" name="MyMap"> 
  40.                             ...... Call some map functions......
  41. </table>
  42.  
  43. </body>
  44. </html>
  45.  
Jul 24 '07 #3

epots9
Expert 100+
P: 1,351
the problem that your expericing usually happens when an error happens and it halts everything, i'll still looking through it i'll post anything i find...oh is this code online? it would make it easier to debug.
Jul 24 '07 #4

P: 10
Thank you for your concern.

I was trying to upload the files into my personal website, and it was assumed that index2 will not function because it includes MapScript javascript and Horizontol Script.js. while index3 should function properly (map changes) , But unfortunatly both are not swaping now, I assume because the freeservers website includes a lot of scripts. and obviously they are defecting that of MapScript.

both scripts
http://mohammedtleis.8m.com/index2.html

one script
http://mohammedtleis.8m.com/index3.html
Jul 25 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.