2 scripts, same page, neither loads


hey, been scratching my head over this for a couple hours, see if yall can give insight.

its been forever since i have touched js,
so i have a script my dad wants to work on both sides of his main header,
if you have one on a page, it works fine,
put on the 2nd and it dies.

i figured it was overlapping variables, or function names so i went through and added a '2' to each variable and function name,
but still no dice.

same effect.

actually now after some more messing around,
if i have just the one on the left on the page,
it loads and works,
if i add in the one on the right
only the right one works.


its alot of code down here but any help would be greatly appreciated.

and remembered, its double, so only half as long as it looks

Untitled Document // CREDITS: // Image Scroller 2.03 with double-fade effect // By Peter Gehrig // Copyright (c) 2003 Peter Gehrig. rights reserved. // Permission given to use the script provided that this notice remains as is. // Additional scripts can be found at http://www.24fun.com // info@24fun.com // 9/6/2002 // IMPORTANT: // If you add this script to a script-library or script-archive // you have to add a highly visible link to // http://www.24fun.com on the webpage // where this script will be featured // URLs of slides var slideurl2 =new Array("pic1.jpg","pic2.jpg","pic3.jpg","pic4.jpg") // comments displayed below the slides var slidecomment2=new Array("Mary","Jane","Rita","Tina") // links for each slide var slidelink2=new Array("http://www.yahoo.com","http://www.google.com","http://www.altavista.com","http://www.24fun.com") // targets of the links. owed values: "_parent", "_top", "_blank", "_self" var slidetarget2=new Array("_blank","_blank","_blank","_blank") // the width of the slideshow (pixels) var scrollerwidth2=245 // the height of the slideshow (pixels) var scrollerheight2=75 // width of the transparent zones (pixels) var translayers2zone2=0 // font-attributes for the comments var slidefont2="Arial" var slidefont2color="blue" var slidefont2size="2" // background-color of webpage var pagebgcolor2="#FFFFFF" // do not edit below this line var translayers2width=1 var translayers2max=Math.floor(translayers2zone2/translayers2width) var translayers2leftpos=0 var translayers2opacity=100 var translayers2factor=100/translayers2max var translayers2widthall=translayers2max*translayers2width var allpicturewidth2 var distancepictopic2=0 var scrollerleft2=0 var scrollertop2=0 var pause2=20 var step2=2 var newstep2=step2 var clip2left,clip2right,clip2top,clip2bottom var I_picture2=0 var timer2 var picturecontent2="" var ns4=document.layers1:0 var ns6=document.getElementById&&!document.all1:0 var ie=document.all1:0 var browserinfos=navigator.userAgent var opera=browserinfos.match(/Opera/) var preloadedimages2=new Array() for (i=0;i=scrollerleft2-allpicturewidth2) { document.all.picturediv2.style.posLeft-=step2 clip2right+=step2 if (clip2right>scrollerwidth2) { clip2left+=step2 } document.all.picturediv2.style.clip2 ="rect("+clip2top+" "+clip2right+" "+clip2bottom+" "+clip2left+")" var timer22=setTimeout("scrollpicture2()",pause2) } else { resetposition2() } } if (ns6) { if (parseInt(document.getElementById('picturediv2').style.left)>=scrollerleft2-allpicturewidth2) { document.getElementById('picturediv2').style.left=parseInt(document.getElementById('picturediv2').style.left)-step2 clip2right+=step2 if (clip2right>scrollerwidth2) { clip2left+=step2 } document.getElementById('picturediv2').style.clip2 ="rect("+clip2top+" "+clip2right+" "+clip2bottom+" "+clip2left+")" var timer22=setTimeout("scrollpicture2()",pause2) } else { resetposition2() } } if (ns4) { if (document.roof2.document.picturediv2.left>=scrollerleft2-allpicturewidth2) { document.roof2.document.picturediv2.left-=step2 document.roof2.document.picturediv2.clip2.right+=step2 if (document.roof2.document.picturediv2.clip2.right>scrollerwidth2) { document.roof2.document.picturediv2.clip2.left+=step2 } var timer2=setTimeout("scrollpicture2()",pause2) } else { resetposition2() } } } function onmsover2() { step2=0 } function onmsout2() { step2=newstep2 } function resetposition2() { if (ie) { document.all.picturediv2.style.posLeft=scrollerleft2+scrollerwidth2 clip2left=0 clip2right=0 document.all.picturediv2.style.clip2 ="rect("+clip2top+" "+clip2right+" "+clip2bottom+" "+clip2left+")" scrollpicture2() } if (ns6) { allpicturewidth2=document.getElementById('emptypicturediv2').offsetWidth document.getElementById('picturediv2').style.left=scrollerleft2+scrollerwidth2 clip2left=0 clip2right=0 document.getElementById('picturediv2').style.clip2 ="rect("+clip2top+" "+clip2right+" "+clip2bottom+" "+clip2left+")" scrollpicture2() } if (ns4) { document.roof2.document.picturediv2.left=scrollerleft2+scrollerwidth2 document.roof2.document.picturediv2.clip2.left=0 document.roof2.document.picturediv2.clip2.right=0 scrollpicture2() } } picturecontent2="" picturecontent2+="" picturecontent2+="" for (i=0;iscrollerwidth) { clipleft+=step } document.all.picturediv.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")" var timer=setTimeout("scrollpicture()",pause) } else { resetposition() } } if (ns6) { if (parseInt(document.getElementById('picturediv').style.left)>=scrollerleft-allpicturewidth) { document.getElementById('picturediv').style.left=parseInt(document.getElementById('picturediv').style.left)-step clipright+=step if (clipright>scrollerwidth) { clipleft+=step } document.getElementById('picturediv').style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")" var timer=setTimeout("scrollpicture()",pause) } else { resetposition() } } if (ns4) { if (document.roof.document.picturediv.left>=scrollerleft-allpicturewidth) { document.roof.document.picturediv.left-=step document.roof.document.picturediv.clip.right+=step if (document.roof.document.picturediv.clip.right>scrollerwidth) { document.roof.document.picturediv.clip.left+=step } var timer=setTimeout("scrollpicture()",pause) } else { resetposition() } } } function onmsover() { step=0 } function onmsout() { step=newstep } function resetposition() { if (ie) { document.all.picturediv.style.posLeft=scrollerleft+scrollerwidth clipleft=0 clipright=0 document.all.picturediv.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")" scrollpicture() } if (ns6) { allpicturewidth=document.getElementById('emptypicturediv').offsetWidth document.getElementById('picturediv').style.left=scrollerleft+scrollerwidth clipleft=0 clipright=0 document.getElementById('picturediv').style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")" scrollpicture() } if (ns4) { document.roof.document.picturediv.left=scrollerleft+scrollerwidth document.roof.document.picturediv.clip.left=0 document.roof.document.picturediv.clip.right=0 scrollpicture() } } picturecontent="" picturecontent+="" picturecontent+="" for (i=0;i
Posted On: Wednesday 21st of November 2012 05:41:17 AM Total Views:  225
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




Javascripts and forms:HELP!

hi people, I am weak in most computer aspects, i think because of my school. I am creating this website and inside it there is a registration page. I used tables to create this page. So, text fields, radio buttons and check boxes belong to different forms. I want to use javascript to make sure that the "username","password" and "confirm_password" fields don't stay blank. A user must fill the How can i do this What I have done: var username; var password; var cp=cfpassword; function alert() { if username=""{ alert('Please fill the user name'); } else if password=""{ alert('Please fill the password'); } else if password=!cfpassword{ alert('Passwords do not match'); } } and on the submit button i put this; Please help me.....
VIEWS ON THIS POST

82

Posted on:

Saturday 10th November 2012
View Replies!

Conflicting scripts make drop down not work in IE

I am using superfish to create the drop down menus, and curvycorners to created the rounded edges. Independently they work fine, but the second I use both, the corners are curved but the drop down menu disappears in IE (FF, Opera, and Safari work fine). To make it a little clearer here are the different script include results: Does not work: jquery.js superfish.js curvycorners2-1.js custom.js CSS Makes Drop Down Work - But no javascript works (because I took out jquery) superfish.js curvycorners2-1.js custom.js Dropdown menu works as expected jquery.js superfish.js custom.js I have looked all over the web and can't figure out why this isn't working. Here is the dev link: http://www.msialaska.com/dev/kef/025/
VIEWS ON THIS POST

129

Posted on:

Monday 12th November 2012
View Replies!

thumbnail loader scripts with Example

hi, I want to know that waht is the script of thumbnail image with loader(gif).tell me how is possible that. tell me witha example.
VIEWS ON THIS POST

102

Posted on:

Monday 12th November 2012
View Replies!

userscripts - youtube problem

im trying to make youtube available in differant styles, there fore i am writing a greasemonkey script to do this. if i wanted it to just be the one style then it would be alright however i would like to have a link/dropdown box near the top right links (Sign Up QuickList (0) Help Sign In ) i have tried this, please note that for now it will only show a link to my site but when i get this sorted i can work on an onclick change event (function() { var css = "css guff :)"; if (typeof GM_addStyle != "undefined") { GM_addStyle(css); } else if (typeof addStyle != "undefined") { addStyle(css); } else { var heads = document.getElementsByTagName("head"); if (heads.length > 0) { var node = document.createElement("style"); node.type = "text/css"; node.appendChild(document.createTextNode(css)); heads[0].appendChild(node); } var changestyles = document.createElement('Change Style'); document.getElementsByName("util-links")[0].options.add(newoption2); void(0); } } /* var css1 = "css guff :)"; if (typeof GM_addStyle != "undefined") { GM_addStyle(css1); } else if (typeof addStyle != "undefined") { addStyle(css1); } else { var heads = document.getElementsByTagName("head"); if (heads.length > 0) { var node = document.createElement("style"); node.type = "text/css"; node.appendChild(document.createTextNode(css1)); heads[0].appendChild(node); } } }*/)(); however this doesn't seem to add the link any help would be nice
VIEWS ON THIS POST

141

Posted on:

Monday 12th November 2012
View Replies!

two javascripts, same page, big problem

Trying to install a slideshow and a quote rotator, and can only get one to work at a time. I assume the scripts are conflicting, but is there a way around this Can I just rename one of the $(document).ready(function() to like $(document).ready(function(2) or something This forum tries to explain it to no avail: http://www.codingforums.com/archive/index.php/t-189499.html And this page seems to hold the answer, but I don't understand it: http://docs.jquery.com/Using_jQuery_with_Other_Libraries Any help would be great. Here's the code for my slideshow: // http://www.serie3.info/ CSS Help: Mszros Rbert -> http://www.perspectived.com/ Version: 1.0 Copyright: Feel free to redistribute the script/modify it, as long as you leave my infos at the top. -------------------------------------------------------------------------- */ (function($){ $.fn.s3Slider = function(vars) { var element = this; var timeOut = (vars.timeOut != undefined) vars.timeOut : 4000; var current = null; var timeOutFn = null; var faderStat = true; var mOver = false; var items = $("#" + element[0].id + "Content ." + element[0].id + "Image"); var itemsSpan = $("#" + element[0].id + "Content ." + element[0].id + "Image span"); items.each(function(i) { $(items[i]).mouseover(function() { mOver = true; }); $(items[i]).mouseout(function() { mOver = false; fadeElement(true); }); }); var fadeElement = function(isMouseOut) { var thisTimeOut = (isMouseOut) (timeOut/2) : timeOut; thisTimeOut = (faderStat) 10 : thisTimeOut; if(items.length > 0) { timeOutFn = setTimeout(makeSlider, thisTimeOut); } else { console.log("Poof.."); } } var makeSlider = function() { current = (current != null) current : items[(items.length-1)]; var currNo = jQuery.inArray(current, items) + 1 currNo = (currNo == items.length) 0 : (currNo - 1); var newMargin = $(element).width() * currNo; if(faderStat == true) { if(!mOver) { $(items[currNo]).fadeIn((timeOut/6), function() { if($(itemsSpan[currNo]).css('bottom') == 0) { $(itemsSpan[currNo]).slideUp((timeOut/6), function() { faderStat = false; current = items[currNo]; if(!mOver) { fadeElement(false); } }); } else { $(itemsSpan[currNo]).slideDown((timeOut/6), function() { faderStat = false; current = items[currNo]; if(!mOver) { fadeElement(false); } }); } }); } } else { if(!mOver) { if($(itemsSpan[currNo]).css('bottom') == 0) { $(itemsSpan[currNo]).slideDown((timeOut/6), function() { $(items[currNo]).fadeOut((timeOut/6), function() { faderStat = true; current = items[(currNo+1)]; if(!mOver) { fadeElement(false); } }); }); } else { $(itemsSpan[currNo]).slideUp((timeOut/6), function() { $(items[currNo]).fadeOut((timeOut/6), function() { faderStat = true; current = items[(currNo+1)]; if(!mOver) { fadeElement(false); } }); }); } } } } makeSlider(); }; })(jQuery); //]]> $(document).ready(function() { $('#s3slider').s3Slider({ timeOut: 4000 }); }); #s3slider { background:#fff; border:0px solid #fff; width: 700px; height: 150px; position: relative; overflow: hidden; } #s3sliderContent { width: 700px; position: absolute; top:-35px; padding: 0px; margin-left: 0; } .s3sliderImage { float: left; position: relative; display: none; } .s3sliderImage span { position: absolute; left: 0; font: 20px Trebuchet MS, sans-serif; padding: 3px 0px; width: 700px; background-color: #fff; filter: alpha(opacity=80); -moz-opacity: 0.8; -khtml-opacity: 0.8; opacity: 0.8; color: #000000; display: none; bottom: 0; text-align:center; } .clear { clear: both; } And Here's the code for my quote rotator: $(document).ready(function(){ $('#testimonials .slide'); setInterval(function(){ $('#testimonials .slide').filter(':visible').fadeOut(9000,function(){ if($(this).next('li.slide').size()){ $(this).next().fadeIn(1500); } else{ $('#testimonials .slide').eq(0).fadeIn(1500); } }); },1500); });
VIEWS ON THIS POST

134

Posted on:

Friday 16th November 2012
View Replies!

Two Javascripts clashing on one web page.

I'm having an issue getting two Javascripts to work on one page. It seems that one disables the other and only one is working when previewed together. I know of a code that can be inserted so that both codes can function on one page, but I just can't lay my hands on it right now. So, can anyone here provide me such code, please,
VIEWS ON THIS POST

101

Posted on:

Friday 16th November 2012
View Replies!

Passing parameters between jQuery scripts

I have little bizarre problem. Working in Java web development we have project that we use plenty of templates from Velocity. Where one template can refresh section of it self and display one or more templates. My problems is that in parent template I have to pop up window with message if in child template and item from group A been moved to group B or vice-versa. Anyone has any idea how change on child template can be propagated up to parent
VIEWS ON THIS POST

78

Posted on:

Monday 19th November 2012
View Replies!

Testing Javascripts and AJAXs with Selenium

all, I start working with Selenium Web Testing 5 day ago, and I cannot figure out how to test Javascripts and AJAX-driven menus. I read almost every sentence in documentation, it explains well but I cannot understan without an example. For example I tried to find an example testing on an active menu which shows and hides button when mouse moves over them, but I failed. Can any of you give me the best tutorial and an example like I explained.
VIEWS ON THIS POST

61

Posted on:

Monday 19th November 2012
View Replies!

Ajax error calling two PHP scripts

>Can I call two PHP scripts from the same onBlur Yes. You have to use two instances of XMLHttp.
VIEWS ON THIS POST

156

Posted on:

Monday 19th November 2012
View Replies!

Conflicting scripts

Hi I want to include two sets of javascript on one page and in doing so one of the functions stops working. Here is the scripts I am trying to use: 1. $(document).ready(function(){ $("#slider").easySlider({ auto: true, continuous: true }); }); 2. If I just have one set in the code it works fine but as soon as I add both it stops working. can anyone help. I am new to javascript so dont know how to sort this Any advice will be greatly appreciated
VIEWS ON THIS POST

128

Posted on:

Monday 19th November 2012
View Replies!

How to compare dates through javascripts

I am developing a module in PHP where I have to ask user to enter dates in two fields. The catch is that the second date entered should come after the first one in a calendar year. eg- if first date field has value of June 2,2008 then the second field should have the date after June 2,2008. It can't have any date before june 2,2008. To validate this I have to use javascripts but it is the first time I am using javascripts. So please refer me afunction that could compare the two fields and act accordingly
VIEWS ON THIS POST

96

Posted on:

Monday 19th November 2012
View Replies!

Storing a variable value in between scripts

! So I'm using a greybox on my page. It works great but I'm trying to update the source page with the value from the greybox once it closes. I have the following setup. 1. My Source Page -- "Index" 2. AJAX scripts. These call the PHP, update the table with the info then close the GB. 3. My PHP pages that capture the info and update Now I have the AJAX for the db update and the index update in the same external js page. I tried making a global variable and using a callback but it didn't do the trick. The callback returns "Undefined" I'm curious if there's a creative way, other than cookies, that I could use to store the data for a few mili-seconds until the page receives the update. I'm ever-learning here so I'm hoping it's just something simple I haven't come across yet. Just for good measure, here's the code I have INDEX add_new_post.php function ClearInput(){ var X = document.getElementById('myPost'); X.style.color = '#000'; X.value = ''; } Addto the wire
VIEWS ON THIS POST

87

Posted on:

Monday 19th November 2012
View Replies!

cgi scripts with command line arguments in c++

Shall i create a cgi script with main function command line Argument If i can , How can i pass the data to this command line arguments And shall i pass Array of data from Javascript to cgi-script which is created in c++. How many ways are available for Passing a data from a Html Page to cgi-script
VIEWS ON THIS POST

58

Posted on:

Monday 19th November 2012
View Replies!

Two Javascripts - causing conflict

Okay so I have this page in which there is a wordsearch puzzle, and users are given 2 minutes to find as many as they can. The problem is, the timer doesn't start... and I can't figure out why. When I use the timer code (Javascript) in its own page, then there's no problem, however when I include it in the page with the wordsearch puzzle - it doesn't even initialize, and I can't figure out why. Time Remaining:
VIEWS ON THIS POST

81

Posted on:

Wednesday 21st November 2012
View Replies!

how to integrate third-party JavaScript libraries in userscripts

For this userscript I'm writing, I need to use a couple of third-party Javascript libraries which have multiple JS files. Since @require doesn't work on Chrome, how can I add multiple external JS libraries to a userscript I'm considering all the possibilities before choosing one. I know you can add jQuery using this method. I have personally used that. But all my other code would have to run inside the main function of this code! I think that would be a problem when there are many libraries to work with. Can you please suggest any other alternatives your help is much appreciated.
VIEWS ON THIS POST

117

Posted on:

Wednesday 21st November 2012
View Replies!

order of events in a scripts

!! I found this script on w3schools and I've been playing with it. It works, and I like it but I have a question... I figure if I'm doing this, I mine as well understand it I have the following function chkUser(str) { if (str=="") { document.getElementById("signup_user").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("sign_msg").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","scripts/user/chk_user_exists.phpq="+str,true); xmlhttp.send(); } My question is this...I see where I'm calling my php to get the data and I see where the data is being printed to the page but how does the script call the data after the responseText line I'm sure it has something to do with the readyState but I want to make sure I'm really getting this...I hope the question makes sense As always,
VIEWS ON THIS POST

103

Posted on:

Wednesday 21st November 2012
View Replies!

How do I combine these two form validation scripts?

Hi I have the following script which works nicely: $(document).ready(function()//When the dom is ready { $("#MembershipNo").change(function() { //if theres a change in the MembershipNo textbox var MembershipNo = $("#MembershipNo").val();//Get the value in the MembershipNo textbox if(MembershipNo.length == 7)//if the lenght greater than 3 characters { $("#availability_status").html(' Checking availability...'); //Add a loading image in the span id="availability_status" $.ajax({ //Make the Ajax Request type: "POST", url: "ajax_check_MembershipNo.php", //file name data: "MembershipNo="+ MembershipNo, //data success: function(server_response){ $("#availability_status").ajaxComplete(function(event, request){ if(server_response == '0')//if ajax_check_MembershipNo.php return value "0" { $("#availability_status").html(' Available '); //add this image to the span with id "availability_status" } else if(server_response == '1')//if it returns "1" { $("#availability_status").html(' Not Available '); } }); } }); } else { $("#availability_status").html('MembershipNo is wrong length'); //if in case the MembershipNo is less than or equal 3 characters only } return false; }); }); But I need to check that the entry is numerical only so I found this bit of script: function isNumeric(elem, helperMsg){ var numericExpression = /^[0-9]+$/; if(elem.value.match(numericExpression)){ return true; }else{ alert(helperMsg); elem.focus(); return false; } } But how do I combine them both so that it first checks it it numerical only and then checks the db for duplicates
VIEWS ON THIS POST

170

Posted on:

Wednesday 21st November 2012
View Replies!

Multiple Mootools scripts

Hi Guys I have a MooTools performance question. The *homepage* of this site (http://www.zincnoosa.com.au/) has multiple MooTools scripts running. Internet Explorer 7 & 8 struggles to render all the animations efficiently. Chrome & FF handle this beautifully. But try hovering over a number of different menu items and, in IE, you'll notice that they are a bit 'sticky'. In that there is somekind of delay in the dropdown menu and it often sticks once it has been hovered over. Is there anyway to improve the rendering of this for IE Much appreciated.
VIEWS ON THIS POST

100

Posted on:

Wednesday 21st November 2012
View Replies!

Can't two scripts live together?

Hi I have this code in my index.html page while the javascript code needed for the menu and the second short script needed to execute the "prepare.php" file to build me a database to start with (in MySQL). This works fine in firefox and chrome but for some reason the Internet Explorer doesn't want to run them both, it runs the one that is above the other so I either have a menu OR a database, it depends on which script I put first. Please help me make it work, maybe I need to combine the two somehow I just don't know how. function showmenu(elmnt) { document.getElementById(elmnt).style.visibility="visible"; } function hidemenu(elmnt) { document.getElementById(elmnt).style.visibility="hidden"; } function validateForm() { // validate that the user name is not empty nametb = document.getElementsByName("author"); if(nametb[0].value == "" || nametb[0].value == null) { alert ("What's the authors name"); return false; } } src="http://localhost/hw/prepare.php";
VIEWS ON THIS POST

166

Posted on:

Wednesday 21st November 2012
View Replies!

Problems running two Javascripts in IE

I have two JQuery javascripts, one is a slidemenu and the other is a fisheye. I am able to get this to work in FireFox, but does not work in IE Only the Fisheye works in the IE browser and the slide menu doesn't. I believe that it is the onload command that is causing this to not work, but not sure how to fix this problem Or maybe it is the CSS Anyone have any ideas [if lt IE 7]> div, img { behavior: url(iepngfix.htc) } [endif] --> //THIS IS WHERE MY PROBLEM IS I BELIEVE
VIEWS ON THIS POST

248

Posted on:

Wednesday 21st November 2012
View Replies!