JavaScript - Problem In Using Two Javascript Plugins
Hi All,
I am a novice in javascript. I am trying to use two plugins in a same page. I have seen many articles, and tutorial for debugging the problems related to this. I have also seen the messages on this board which discuss the same issue. However, my knowledge in javascript is very much limited and I could not resolve my problem. I am using two jquery plugins - a) galleria, and b) stepcarousel. I have got them to work separately, tweaked the CSS, and other things to fit them on the webpage, added automatic slideshow in galleria. Now, I am trying to run them simulataneously on the same page. But, it is not working. I have tried to use the jQuery.noConflict (); tag but after using that, the stepcarousel is working but the galleria is not working. Here is the part of the javascript included in the header of my website. Code: <script type="text/javascript" src="../javascripts/jquery.min.js"></script> <script type="text/javascript" src="../javascripts/jquery.timers-1.2.js"></script> <script type="text/javascript" src="../javascripts/jquery.galleria.js"></script> <script type="text/javascript"> jQuery.noConflict (); var t; var timer_is_on=0; var timer=2000; function startSliding() { $.galleria.next(); t=window.setTimeout("startSliding()",timer); } function showSlide() { if (!timer_is_on) { timer_is_on=1; startSliding(); } } function stopSlide() { window.clearTimeout(t); timer_is_on=0; } $(document).ready(function(){ $('.gallery_spandan').addClass('gallery'); // adds new class name to maintain degradability $('ul.gallery').galleria({ history : false, // activates the history object for bookmarking, back-button etc. clickNext : true, // helper for making the image clickable insert : '#main_image', // the containing selector for our main image onImage : function(image,caption,thumb) { // let's add some image effects for demonstration purposes // fade in the image + caption image.css('display','none').fadeIn(400); caption.css('display','none').fadeIn(400); // fetch the thumbnail container var _li = thumb.parents('li'); // fade out inactive thumbnail _li.siblings().children('img.selected').fadeTo(400,0.3); // fade in active thumbnail thumb.fadeTo('fast',1).addClass('selected'); // add a title for the clickable image image.attr('title','Next image >>'); }, onThumb : function(thumb) { // thumbnail effects goes here // fetch the thumbnail container var _li = thumb.parents('li'); // if thumbnail is active, fade all the way. var _fadeTo = _li.is('.active') ? '1' : '0.3'; // fade in the thumbnail when finnished loading thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500); // hover effects thumb.hover( function() { thumb.fadeTo('fast',1); }, function() { _li.not('.active').children('img').fadeTo('fast',0.3); } // don't fade out if the parent is active ); } }); }); </script> <script type="text/javascript" src="stepcarousel.js"></script> <script type="text/javascript"> stepcarousel.setup({ galleryid: 'albumcovers_gallery', //id of carousel DIV beltclass: 'albumcovers_belt', //class of inner "belt" DIV containing all the panel DIVs panelclass: 'albumcovers_panel', //class of panel DIVs each holding content autostep: {enable:true, moveby:1, pause:3000}, panelbehavior: {speed:500, wraparound:false, persist:true}, defaultbuttons: {enable: true, moveby: 1, leftnav: ['images/prev_left.gif', -20, 20], rightnav: ['images/next_right.gif', 20, 20]}, statusvars: ['statusA', 'statusB', 'statusC'], //register 3 variables that contain current panel (start), current panel (last), and total panels contenttype: ['inline'] //content setting ['inline'] or ['ajax', 'path_to_external_file'] }); </script> The step carousel code also uses the jQuery.noConflict ---> Code: jQuery.noConflict(); var stepcarousel={ ajaxloadingmsg: '<div style="margin: 1em; font-weight: bold"><img src="ajaxloadr.gif" style="vertical-align: middle" /> Fetching Content. Please wait...</div>', //customize HTML to show while fetching Ajax content defaultbuttonsfade: 0.4, //Fade degree for disabled nav buttons (0=completely transparent, 1=completely opaque) configholder: {}, getCSSValue:function(val){ //Returns either 0 (if val contains 'auto') or val as an integer return (val=="auto")? 0 : parseInt(val) }, ... Please help me to debug this problem. I am really stuck. Edit: If you would like to view the webpage where I am trying to do this, please visit he Step Carousel working, Galleria not working. And here, Galleria working separately Thanks in advance, banskt. Similar TutorialsHi! What I really mean is how can you combine the effects from two plugins. Subject line only gives you so much to work with. I'm trying to use the query.corner.js plugin and the gradient (jquery.gradient.js & jquery.dimensions.js) plugins to get a rounded container that has a gradient applied to it. I've tried a few different things like putting a container withing a container and applying one plugin to one and the other to the remainder. No luck! |= Here's the code I'm playing with: 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" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> JQuery combo plugins </title> <style type="text/css"> div.main { background:#0000FF;height:400px;width:400px;margin:auto;font-size:2em;text-align:center;} .main p {padding:20px;} </style> <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="js/jquery.corner.js"></script> <script type="text/javascript" src="/js/jquery.gradient.js"></script> <script type="text/javascript" src="/js/jquery.dimensions.js"></script> <script type="text/javascript"> $(function(){ $('div.main').corner("20px"); }); </script> <script type="text/javascript"> $(function() { $('.gmain').gradient({ from: '0000FF', to: 'FFFFFF', direction: 'horizontal', position: 'verticle', }); }); </script> </head> <body> <div class="main"> <div class="gmain"> <p>Hi There!</p> </div> </div> </body> </html> I attached the js plugins and just changed the extension from js to txt so I could attach them. I did NOT attach the jquery script since I figure that is pretty common. Corner -> jquery.corner.txt Dimension -> jquery.dimensions .txt Gradient -> jquery.gradient.txt Thanks for your help! Hi very good site I do a query is as follows I have this theme using jQuery and I've included a Featured Content Gallery plugin called the problem is that I have a conflict with the plugin and does not show the slider post Then I discovered that removing this line of code <? php include (TEMPLATEPATH. '/ includes / scripts.php');?> the footer if it shows the slider post but let me operate the menus, using it as the call of scritp any solution? this is the theme http://su-paginaweb.com/website/Polished2.zip thanks in advance Hello guys, I was wondering if someone could help me out. I am trying to create an image gallery in javascript without the use of jquery, mootools or any other library. The tutorials out there and even the javascript books I own all use jquery or other library. I currently have some thumbnails and when clicked, they should display a bigger image in a selected space. The image gallery is to be looped and to start automatically while being controlled by buttons or thumbnails. What is the best way to go about this, please bear in mind that I am quite new javascript itself. Thanks Vou Hi everybody I have a problem I want a header that is a slideshow and use lightbox for other images. No I have this all working but not at the same time. If I use this code in this order only the first script that is the lightbox script works. PHP Code: <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/pirobox.js"></script> <script type="text/javascript"> $(document).ready(function(){ $().piroBox({ my_speed: 300, //animation speed bg_alpha: 0.5, //background opacity slideShow : 'true', // true == slideshow on, false == slideshow off slideSpeed : 3, //slideshow close_all : '.piro_close' // add class .piro_overlay(with comma)if you want overlay click close piroBox }); }); </script> <script src="http://code.jquery.com/jquery-latest.js"></script> <script src="js/jquery.cycle.all.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('.slideshow').cycle({ fx: 'scrollLeft', speed: 1000, timeout: 7000 }); }); </script> If I use this code so I switched the order only the slideshow works: PHP Code: <script src="http://code.jquery.com/jquery-latest.js"></script> <script src="js/jquery.cycle.all.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('.slideshow').cycle({ fx: 'scrollLeft', speed: 1000, timeout: 7000 }); }); </script> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/pirobox.js"></script> <script type="text/javascript"> $(document).ready(function(){ $().piroBox({ my_speed: 300, //animation speed bg_alpha: 0.5, //background opacity slideShow : 'true', // true == slideshow on, false == slideshow off slideSpeed : 3, //slideshow close_all : '.piro_close' // add class .piro_overlay(with comma)if you want overlay click close piroBox }); }); </script> I also tried this: but then they both did not work PHP Code: <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript" src="js/jquery.cycle.all.min.js"></script> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/pirobox.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('.slideshow').cycle({ fx: 'scrollLeft', speed: 1000, timeout: 7000 }); $().piroBox({ my_speed: 300, //animation speed bg_alpha: 0.5, //background opacity slideShow : 'true', // true == slideshow on, false == slideshow off slideSpeed : 3, //slideshow close_all : '.piro_close' // add class .piro_overlay(with comma)if you want overlay click close piroBox }); }); </script> Can you help me solve this problem so they both work? Hi everybody I have a problem I want a beautiful accordion header on my website and use pirobox that is a lightbox version. I had this problem before but then u used a slideshow instead of this accordion header. If I use this code: only the accordion works Code: <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/pirobox.js"></script> <script type="text/javascript"> $(document).ready(function(){ $().piroBox({ my_speed: 300, //animation speed bg_alpha: 0.5, //background opacity slideShow : 'true', // true == slideshow on, false == slideshow off slideSpeed : 3, //slideshow close_all : '.piro_close' // add class .piro_overlay(with comma)if you want overlay click close piroBox }); }); </script> <script language="javascript" type="text/javascript" src="js/mootools.js"></script> <script language="javascript" type="text/javascript" src="js/script.js"></script> but if I change the order like this: only the pirobox works Code: <script language="javascript" type="text/javascript" src="js/mootools.js"></script> <script language="javascript" type="text/javascript" src="js/script.js"></script> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/pirobox.js"></script> <script type="text/javascript"> $(document).ready(function(){ $().piroBox({ my_speed: 300, //animation speed bg_alpha: 0.5, //background opacity slideShow : 'true', // true == slideshow on, false == slideshow off slideSpeed : 3, //slideshow close_all : '.piro_close' // add class .piro_overlay(with comma)if you want overlay click close piroBox }); }); </script> Then in the demo version there is this code: Code: <script type="text/javascript"> new LofmCordion( {wapperSelector: $E('#lof-cordion-1 .lof-cordion-wapper') } ); </script> I don't know where to use it. In the demo version it's in the end, but I tried that and it still didn't work. I also used it immidiately after: Code: <script language="javascript" type="text/javascript" src="js/mootools.js"></script> <script language="javascript" type="text/javascript" src="js/script.js"></script> But it still doesn't work.. Please help me I'm kinda new to javascript and I really want to know how to solve this! thanks how do i make a wordpress website with tabs to different sub-sections without changing pages, its almost seems like an iframe... example: http://www.alexa.com/siteinfo/google.com [look at the tabbing, and how it doesn't change URL] how can i make it like this using wordpress? is there a plugin? also, i need something that will make an iframe for me [of another website] but make it impossible to click or right-click, BUT can scroll. is there some type of plugin for wordpress that can help me do that? [so i can customize the template of the iframe and the page the holds the iframe] thanks!! (: I got an index.php Code: <html> <form action="bacakomik.php" method='post'> <select name="kodekomik"> <option value='../komik1/|23'>Judul Komik1</option> <option value="../komik2/|20">Judul Komik2</option> <option value="../komik3/|10">Juduk Komik3</option> <option value="../komik4/|20">Judul Komik4</option> </select> <input type="submit" /> </form> <?php echo ('<select>'); echo ('<option value= "'.$i.'">'.'Page '.$i.'</option>'); echo ('</select>'); ?> </html> As you can see, each of the option brings specific value "../komik1/|23" komik1 is a directory | is a delimiter 23 is the pages in one chapter and can be considered also as how many images are there on a specific directory This is my bacakomik.php Code: <?php $dirkomik = $_POST['kodekomik']; $exploded = explode("|", $dirkomik); echo ($exploded[0]); //picture directory echo ("<br>"); echo ($exploded[1]); //total page in the comic $pagecount = (int)$exploded[1]; //Take last posted value, process it right away echo ('<FORM name="guideform"> '); echo ('<select name="guidelinks">'); $i=1; do { echo ('<option value= "'.$i.'">'.'Page '.$i.'</option>'); $i= $i+1; }while($i <= $pagecount); //Printing option and select echo ("</select>"); ?> <input type="button" name="go" value="Go!" onClick="document.getElementById('im').src=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value+'.png';"> </FORM> <img src="img0.jpg" id="im"> With the current code on bacakomik.php, I only can change the img src of id "im" in the same directory only. What I want is that the Javascript could "add" the "$exploded[0]" variable so that the picture can be loaded from different directory. Anyone can do this? I believe that the fix should be somewhere on input tag inside OnClick, or do you know where? Anyway, I found this on the net http://p2p.wrox.com/php-faqs/11606-q...avascript.html Please help me to those who can... I have an html page with javascript on it, but the page will not work properly. Spent a lot of time on this and can not get it right. Wonder if someone ca help. Hello, I have two arrays sd[16][16] and gd[16][16] in javascript. I need to compare the values of the arrays. Code: Code: var score=0; document.write("<table>"); for(c1=0; c1<16; c1++) { document.write("<tr>"); for(c2=0; c2<16; c2++) document.write("<td onClick='changeColor(this);'>" + gd[c1][c2] + "</td>"); document.write("</tr>"); } document.write("</table>"); function changeColor(tdd) { if(tdd.bgColor=='white') { tdd.bgColor='red'; if (gd[c1][c2] == sd[c1][c2]) score+=5; else score-=2; } else { tdd.bgColor='white'; } } function scc() { document.getElementById('scf').innerHTML = score; } </script> <br><br><center><button type='button' onclick='scc()'> Click to see current score</button> <p id="scf">0</p> </center> <br><br> <center><input type="submit" value="Get Solution"/></center> When I try to display score by clicking the "Click to see current score" button, the score is not displayed. Could someone please tell me the problem. Hi im wondering if someone could be of some help please, im a newbie to javascript and after some help and advice if possible please. Ive used a template from the web which was a quiz template. Im just trying to get my javascript script to work. I want it to populate my html question/advice box so people can input what there answer to the question and it will give them advice. It's for a data classification advice for a work project. I just dont know where im going wrong or what im missing out - ive read loads of help sections on the web and still cant get the javascript to populate my html boxes. Any help or advice would be really appreciated. Thanks Lee Heres my html code which seems to work ok... the box etc is displayed just doesnt have any content. ----------------------------------------------------------------------- Code: <form method="POST"> <div align="center"><center><table BORDER="1"> <tr> <td COLSPAN="2" BGCOLOR="#4C0000"><div align="center"><center><p><font SIZE="+3" COLOR="#FFFFFF">Data Classification </font></td> </tr> <tr> <td COLSPAN="2" BGCOLOR="#4C0000"><div align="center"><center><p><font SIZE="-1" COLOR="#FFFFFF">2010 <a HREF="Data Governance</font> </p> </center></div><div align="center"><center><p><font COLOR="#FFFFFF">Click on "Next Question" to start advice. Be sure to use small letters (no caps) when entering your letter choice.</font> </td> </tr> <tr> <td><b>Question #:</b></td> <td ALIGN="LEFT"><input TYPE="TEXT" NAME="questNo" SIZE="4"></td> </tr> <tr> <td><b>Question:</b></td> <td><div align="center"><center><p><textarea COLS="70" ROWS="2" name="question" wrap="virtual"></textarea></td> </tr> <tr> <td ALIGN="RIGHT"><b>a)</b></td> <td><div align="center"><center><p><input TYPE="TEXT" NAME="choiceA" SIZE="75"></td> </tr> <tr> <td ALIGN="RIGHT"><b>b)</b></td> <td><div align="center"><center><p><input TYPE="TEXT" NAME="choiceB" SIZE="75"></td> </tr> <tr> <td ALIGN="RIGHT"><b>c)</b></td> <td><div align="center"><center><p><input TYPE="TEXT" NAME="choiceC" SIZE="75"></td> </tr> <tr> <td ALIGN="RIGHT"><b>d)</b></td> <td><div align="center"><center><p><input TYPE="TEXT" NAME="choiceD" SIZE="75"></td> </tr> <tr> <td ALIGN="RIGHT"><b>Your choice:</b></td> <td><input TYPE="TEXT" NAME="yourChoice" SIZE="4"></td> </tr> <tr> <td COLSPAN="2"><div align="center"><center><p><input TYPE="button" VALUE="Check Current Advice" onClick="checkAnswer(this.form)"><input TYPE="button" VALUE="Next Question" onClick="nextQuestion(this.form)"> <input TYPE="reset" VALUE="Start Over" onClick="clearForm(this.form)"></td> </tr> <tr> <td ALIGN="RIGHT"><b>Results:</b></td> <td><div align="center"><center><p><textarea COLS="70" ROWS="3" name="Advice" wrap="virtual"></textarea></td> </tr> <tr> </form> -------------------------------------------------------------------------- Now heres my javascript which i just cant seem to get to work or integrate with the html question/advice box. There will be some text in there that was originally part of the template that i was going to remove at a later stage once id got a better underatnding of where i was going wrong. Code: <html> <head> <script LANGUAGE="JavaScript"> <!-- hide this script tag's contents from old browsers ---> function jumpBox(list) { location.href = list.options[list.selectedIndex].value } //Lee Quinn 2010 All Rights Reserved function init() { questions = new Array() questions[1] = "Is the information you are collecting or creating any of the following?" questions[2] = "Is the information you are collecting or creating any of the following?" questions[3] = "Is the information you are collecting or creating any of the following?" questions[4] = "Is the information you are collecting or creating any of the following?" answerA = new Array() answerA[1] = "Marketing brochures, Customer disclosure statements,Published annual reports, Interviews with news media, Press releases" answerA[2] = "Employee Handbook,Telephone Directory,Organization Charts,Policies and Standards,Training Manuals" answerA[3] = "Customer records, Correspondence containing customer information, Credit card listings,Personnel records/Employee performance reviews,Unit business plans,Proprietary/custom software,Budget information,Internal audit reports,Business reports on strategy, exposures etc" answerA[4] = "Strategic Plans,Encryption keys,Details of mergers or acquisitions,Financial results prior to publication,Online access codes such as passwords or pin" answerB = new Array() answerB[1] = "None of the above" answerB[2] = "None of the above" answerB[3] = "None of the above" answerB[4] = "None of the above" rightAns = new Array rightAns[1] = "A" rightAns[2] = "b" rightAns[3] = "c" rightAns[4] = "d" reference = new Array() reference[1] = "You have indicated yes to question 1, therefore the information you are collecting/creating will be classified as PUBLIC information. It is information that can be disclosed to anyone without violating an individual?s right to privacy. Knowledge of this information does not expose CFS to financial loss, embarrassment, or jeopardize the security of assets." reference[2] = "You have indicated yes to question 2, therefore the information you are collecting/creating will be classified as INTERNAL USE information. It is information that, due to technical or business sensitivity, is limited to employees and contractors who work on-site. It is intended for use only within CFS. Unauthorized disclosure, compromise, or destruction would not have a significant impact on CFS or its employees." reference[3] = "You have indicated yes to question 3, therefore the information you are collecting/creating will be classified as CONFIDENTIAL information. It is information that CFS and its employees have a legal, regulatory, or social obligation to protect. It is intended for use solely within defined groups in CFS. Unauthorized disclosure, compromise, or destruction would adversely impact CFS its customers or its employees. Unless otherwise stated all data should be treated as CONFIDENTIAL.Sensitive data = Confidential or Highly Confidential data." reference[4] = "You have indicated yes to question 4, therefore the information you are collecting/creating will be classified as HIGHLY CONFIDENTIAL information, It is the highest level of classification and is information whose unauthorized disclosure, compromise, or destruction could result in severe damage, provide significant advantage to a competitor, or incur serious financial impact to CFS or its employees. It is intended for restricted use by a very small number of people (possibly 0 or 1) with an explicit, predetermined need to know." } function nextQuestion(form) //set the total number of questions equal to quizend { var quizEnd = eval(4 * 1); if(form.questNo.value =5= quizEnd) { form.question.value = "1"; form.choiceA.value = "Marketing brochures, Customer disclosure statements,Published annual reports, Interviews with news media, Press releases"; form.choiceB.value = "None of the above"; form.choiceC.value = "Unsure"; form.yourChoice.value = "a,b,c,d"; form.results.value = "End of Advice. Your final results are listed below."; } else { if(form.questNo.value == "") {form.questNo.value = 1} else { form.questNo.value = eval(form.questNo.value) + 1; } form.question.value = questions[form.questNo.value]; form.choiceA.value = answerA[form.questNo.value]; form.choiceB.value = answerB[form.questNo.value]; form.choiceC.value = answerC[form.questNo.value]; form.choiceD.value = answerD[form.questNo.value]; form.yourChoice.value = ""; form.results.value = ""; if(form.myScore.value == "") {form.myScore.value = 0; } else { form.myScore.value = form.myScore.value; } } } function checkcurrentadvice(form) { var myScore = 0; var curve = 0; if(form.results.value != "") {form.results.value = "Sorry, no guessing allowed. In order to retry this question you will have to start the quiz over. Click on ''Next Question'' to continue."; } else if(form.yourChoice.value == rightAns[form.questNo.value]) { form.myScore.value = eval(form.myScore.value) + eval(1); form.results.value = "Conratulations! You are correct. That brings your cumulative score to " + form.myScore.value + " out of a possible " + form.questNo.value + ". Click on ''Next Question'' to continue."; } else { form.results.value = "Sorry, you are incorrect. Please refer to " + reference[form.questNo.value] + " before retaking the quiz. This brings your cumulative score to " + form.myScore.value + " out of a possible " + form.questNo.value + ". Click on ''Next Question'' to continue." } function clearForm(form) { form.questNo.value = ""; form.question.value = ""; form.choiceA.value = ""; form.choiceB.value = ""; form.choiceC.value = ""; form.choiceD.value = ""; form.yourChoice.value = ""; form.results.value = ""; form.myScore.value = ""; form.percent.value = ""; form.grade.value = ""; } </script> </head> </html> Hi and hope someone can help. I'm trying to put together some code within a form that tests whether someone has supplied an email address or a telephone number when the Submit button is pressed. Neither of these fields are require mandatory input. Trouble is my current code always supplies a true result even if no data is put in these fields i.e. the 1st IF statement returns true. What am I doing wrong? Here's my code. Thanks R _____ Code: <script type="text/javascript"> function check_id() { if (document.feedback.email !="" || document.feedback.tel !="") { alert("Thank you. You will be entered into our free prize draw. Good luck!"); } else if (document.feedback.email =="" && document.feedback.tel =="") { confirm("You will not be entered in our free prize draw unless you supply your email address or telephone number. Is that O.K?"); } } function clear (){ var email=""; var tel=""; } </script> <form action="" method="get" name="feedback" enctype="application/x-www-form-urlencoded" onSubmit="check_id();" onReset="confirm('This will clear all your entries, is that O.K?'); clear();"> <div> <label for="email">Your email address:</label> <input name="email" type="text" id="email" size="50" value="" /> </div> <div> <label for="tel">Your telephone number:</label> <input name="tel" type="text" id="tel" size="50" value="" /> </div> <div> <input type="reset" name="reset" id="reset" value="Reset" /> <input type="submit" name="submit" id="submit" value="Submit" /> </div> </form> PHP Code: ?><script type="text/javascript"> var answer=confirm("Do you want to update your email?"); if(answer==true) { <?php mysql_query("update user set u_email ='$email' where u_user='$username'"); ?> alert ("You choose update your email."); } if(answer==false) { alert ("You had rejected to update your email."); //answer=0; } </script> <? i put this javascript within my php, it should perform update when i click ok, and perform nothing when i click cancel, but the problem is, it will still perform update although i click cancel. someone can solve this for me pls..? Hi all, I have a Javascript problem that only seems to happen in IE... it works fine in Firefox as I've tested! I have this function: Code: function show_video1(){ document.getElementById('video1').style.display="block"; document.getElementById('video2').style.display="none"; document.getElementById('video3').style.display="none"; } function show_video2(){ document.getElementById('video1').style.display="none"; document.getElementById('video2').style.display="block"; document.getElementById('video3').style.display="none"; } function show_video3(){ document.getElementById('video1').style.display="none"; document.getElementById('video2').style.display="none"; document.getElementById('video3').style.display="block"; } etc... what it does is basically switch videos, when a link is click. The problem in IE is that the video continues to play when switched... meaning that videos play 'over the top of each other'. Can anyone advise on this, as I say seems to be fine in Firefox! Many thanks, Greens85 Hi All, I am desperately pulling my hair out... can you help me understand how I can resolve the below errors: SCRIPT1028: Expected identifier, string or number calender.js, line 318 character 17 SCRIPT1006: Expected ')' blenheim-palace-lunch-cotswolds-p-170.html, line 88 character 35 SCRIPT5007: The value of the property 'getStartDate' is null or undefined, not a Function object blenheim-palace-lunch-cotswolds-p-170.html, line 643 character 7 For this web address... http://tinyurl.com/79msxqm What can I change to fix the issue? The site is working properly in all other browsers but not IE9. Hope you can help. Thanks. Hi Guys, I cant seem to get my piece of code to with IE8, I have created a drop down box which gets counties from a database. I have attached the code below. Can someone please point me in the right direction. Code: <script language="JavaScript" type="text/javascript"> var http = false; if(navigator.appName == "Microsoft Internet Explorer") { http = new ActiveXObject("Microsoft.XMLHTTP"); } else { http = new XMLHttpRequest(); } var http2 = false; if(navigator.appName == "Microsoft Internet Explorer") { http2 = new ActiveXObject("Microsoft.XMLHTTP"); } else { http2 = new XMLHttpRequest(); } function sndReq() { if (document.getElementById('country').value == '0' ) { document.getElementById('state').disabled = true; document.getElementById('state').value = '0'; } else { document.getElementById('state').disabled = false; } if (document.getElementById('state').value !== null) { http.open('GET','{TPL_VAR_SITEURL}ecom/index.php?action=ecom.changepostage&countryid='+document.getElementById('country').value+'&stateid='+document.getElementById('state').value); } else { http.open('GET','{TPL_VAR_SITEURL}ecom/index.php?action=ecom.changepostage&countryid='+document.getElementById('country').value); } http.onreadystatechange = changepostage; http.send(null); } function changepostage(){ if(http.readyState == 4){ var response = http.responseText; var update = new Array(); if(response.indexOf('*' != -1)) { update = response.split('*'); document.getElementById(update[1]).innerHTML= update[0]; document.getElementById(update[3]).innerHTML= update[2]; document.getElementById(update[5]).innerHTML= update[4]; document.getElementById(update[7]).innerHTML= update[6]; } } } function sndCountry() { http2.open('GET','{TPL_VAR_SITEURL}ecom/index.php?action=ecom.changecountry&countryid='+document.getElementById('country').value); http2.onreadystatechange = changestate; http2.send(null); } function changestate(){ if(http2.readyState == 4){ var response = http2.responseText; document.getElementById('state').innerHTML= response; } } </script> The error from IE8 is document.getElementById(....) is null or not an object. Line 172 which is This Code: document.getElementById(update[5]).innerHTML= update[4]; Thanks, Jordan Hi there, I only just learning JavaScript and have a question about a bit of script I am playing with. I am basically trying to access XML elements (RSS feed) through a bit of PHP. Everything is working fine when trying to access the <title> and <link>, but when I get to <description> everything breaks down... If I comment out this line var theDescription = descriptions[j].childNodes[0].nodeValue; and <p>' + theDescription + '</p>' then the script works fine and displays the titles and the links of the feed, but with those lines in it all goes to pot. Can anyone tell me what I am doing wrong here? (By the way, don't worry about my method of getting the feed in, using GET etc. This script is part of an AJAX tutorial and I am just messing with it, trying to make it display the title, link, and description from the rss feed) Here is my html/JavaScript: Code: <html><head><title>AJAX XML Example</title> </head><body> <h2>Loading XML content into a DIV</h2> <div id='info'>This sentence will be replaced</div> <script> nocache = "&nocache=" + Math.random() * 1000000 url = "rss.news.yahoo.com/rss/topstories" request = new ajaxRequest() request.open("GET", "xmlget.php?url=" + url + nocache, true) out = ""; request.onreadystatechange = function() { if (this.readyState == 4) { if (this.status == 200) { if (this.responseXML != null) { titles = this.responseXML.getElementsByTagName('title') links = this.responseXML.getElementsByTagName('link') descriptions = this.responseXML.getElementsByTagName('description'); for (j = 0 ; j < titles.length ; ++j) { var theTitle = titles[j].childNodes[0].nodeValue; var theLink = links[j].childNodes[0].nodeValue; var theDescription = descriptions[j].childNodes[0].nodeValue; out += '<p><strong>' + theTitle + '</strong><br /><a href="' + theLink + '">' + theLink + '</a></p><p>' + theDescription + '</p>' ; } document.getElementById('info').innerHTML = out } else alert("Ajax error: No data received") } else alert( "Ajax error: " + this.statusText) } } request.send(null) function ajaxRequest() { try { var request = new XMLHttpRequest() } catch(e1) { try { request = new ActiveXObject("Msxml2.XMLHTTP") } catch(e2) { try { request = new ActiveXObject("Microsoft.XMLHTTP") } catch(e3) { request = false } } } return request } </script></body></html> Here is the PHP: Code: <?php // xmlget.php if (isset($_GET['url'])) { header('Content-Type: text/xml'); echo file_get_contents("http://".sanitizeString($_GET['url'])); } function sanitizeString($var) { $var = strip_tags($var); $var = htmlentities($var); return stripslashes($var); } ?> I'm having a problem with a javascript code I put together. For all of the PHP, CSS, HTML that I know, well it doesn't carry over to JavaScript, so my attempt at trying this is probably a very bad attempt. Anyways, what I'm trying to accomplish with this code is to get the height of one table and set the padding-bottom to another table, to keep page dimensions even. Code: <script type="text/javascript"> var divArray = document.getElementById('tablecontent').offsetheight; //Subtracting 442 because that's the height of the table. I'm just trying to add onto the bottom. var subtraction = divarray - 442; var tablesidebar = document.getElementById('tablesidebar'); tablesidebar.style.paddingbottom = subtraction + 'px'; </script> Any help to get this working is well appreciated. Thanks, Jeremy Hi all I am a newbie and I don't know much about JavaScript. Can anyone help me with an issue that I am having. Please see code below. Code: <form id="mySurvey" name="mySurvey" onSubmit="return markMe(this);"> <table width="510" border="0" cellspacing="0" cellpadding="0" align="center" class="datatable1"> <tr> <th class="leftme" width="15"> </a></th> <th width="465">TASKS/ACTIVITIES</th> <th width="30" class="midme">HRS</th> <th width="30" class="midme">MINS</th> </tr> <tr> <td class="leftme">1.</td> <td>Sleep</td> <td class="midme"> <select name="option1h" size="1"> <option value="0" selected>0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> </select> </td> <td class="rightme"> <select name="option1m" size="1"> <option value="0" selected>0</option> <option value="5" >5</option> <option value="10">10</option> <option value="15">15</option> <option value="20">20</option> <option value="25">25</option> <option value="30">30</option> <option value="35">35</option> <option value="40">40</option> <option value="45">45</option> <option value="50">50</option> <option value="55">55</option> </select> </td> </tr> <tr> <td class="leftme">2.</td> <td>Food Preparation/consumption (breakfast, dinner, lunch)</td> <td class="midme"> <select name="option2h" size="1"> <option value="0" selected>0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> </select> </td> <td class="rightme"> <select name="option2m" size="1"> <option value="0" selected>0</option> <option value="5" >5</option> <option value="10">10</option> <option value="15">15</option> <option value="20">20</option> <option value="25">25</option> <option value="30">30</option> <option value="35">35</option> <option value="40">40</option> <option value="45">45</option> <option value="50">50</option> <option value="55">55</option> </select> </td> </tr> <tr> <td class="leftme">3.</td> <td>Work commitments</td> <td class="midme"> <select name="option3h" size="1"> <option value="0" selected>0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> </select> </td> <td class="rightme"> <select name="option3m" size="1"> <option value="0" selected>0</option> <option value="5" >5</option> <option value="10">10</option> <option value="15">15</option> <option value="20">20</option> <option value="25">25</option> <option value="30">30</option> <option value="35">35</option> <option value="40">40</option> <option value="45">45</option> <option value="50">50</option> <option value="55">55</option> </select> </td> </tr> <tr> <td class="leftme">4.</td> <td>Exercise/recreational sports</td> <td class="midme"> <select name="option4h" size="1"> <option value="0" selected>0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> </select> </td> <td class="rightme"> <select name="option4m" size="1"> <option value="0" selected>0</option> <option value="5" >5</option> <option value="10">10</option> <option value="15">15</option> <option value="20">20</option> <option value="25">25</option> <option value="30">30</option> <option value="35">35</option> <option value="40">40</option> <option value="45">45</option> <option value="50">50</option> <option value="55">55</option> </select> </td> </tr> <tr> <td class="leftme">5.</td> <td>Socialising</td> <td class="midme"> <select name="option5h" size="1"> <option value="0" selected>0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> </select> </td> <td class="rightme"> <select name="option5m" size="1"> <option value="0" selected>0</option> <option value="5" >5</option> <option value="10">10</option> <option value="15">15</option> <option value="20">20</option> <option value="25">25</option> <option value="30">30</option> <option value="35">35</option> <option value="40">40</option> <option value="45">45</option> <option value="50">50</option> <option value="55">55</option> </select> </td> </tr> <tr> <td class="leftme">6.</td> <td>Family commitments</td> <td class="midme"> <select name="option6h" size="1"> <option value="0" selected>0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> </select> </td> <td class="rightme"> <select name="option6m" size="1"> <option value="0" selected>0</option> <option value="5" >5</option> <option value="10">10</option> <option value="15">15</option> <option value="20">20</option> <option value="25">25</option> <option value="30">30</option> <option value="35">35</option> <option value="40">40</option> <option value="45">45</option> <option value="50">50</option> <option value="55">55</option> </select> </td> </tr> <tr> <td class="leftme">7.</td> <td>Relaxation (watching television etc.)</td> <td class="midme"> <select name="option7h" size="1"> <option value="0" selected>0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> </select> </td> <td class="rightme"> <select name="option7m" size="1"> <option value="0" selected>0</option> <option value="5" >5</option> <option value="10">10</option> <option value="15">15</option> <option value="20">20</option> <option value="25">25</option> <option value="30">30</option> <option value="35">35</option> <option value="40">40</option> <option value="45">45</option> <option value="50">50</option> <option value="55">55</option> </select> </td> </tr> <tr> <td class="leftme">8.</td> <td>Travel</td> <td class="midme"> <select name="option8h" size="1"> <option value="0" selected>0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> </select> </td> <td class="rightme"> <select name="option8m" size="1"> <option value="0" selected>0</option> <option value="5" >5</option> <option value="10">10</option> <option value="15">15</option> <option value="20">20</option> <option value="25">25</option> <option value="30">30</option> <option value="35">35</option> <option value="40">40</option> <option value="45">45</option> <option value="50">50</option> <option value="55">55</option> </select> </td> </tr> <tr> <td class="leftme">9.</td> <td>Other</td> <td class="midme"> <select name="option9h" size="1"> <option value="0" selected>0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> </select> </td> <td class="rightme"> <select name="option9m" size="1"> <option value="0" selected>0</option> <option value="5" >5</option> <option value="10">10</option> <option value="15">15</option> <option value="20">20</option> <option value="25">25</option> <option value="30">30</option> <option value="35">35</option> <option value="40">40</option> <option value="45">45</option> <option value="50">50</option> <option value="55">55</option> </select> </td> </tr> <tr> <th colspan="4" class="midme"><input type="submit" value="Submit"></th> </tr> </table> </form> </div> <script language="JavaScript"> <!-- function markMe(mySurvey){ var timeCount = 0; var timeLeft=0; var totalHours = 0; var totalMins = 0; for (var i=0; i < mySurvey.elements.length; i++){ var e = document.mySurvey.elements[i]; var inputType = e.type; var inputName = e.name; var inputValue = e.value; if (inputType == 'select-one'){ var theLength = inputName.length; var theKey = (inputName.substring(theLength - 1, theLength)); if (theKey == 'h'){ timeCount+=parseFloat(inputValue*60); } if (theKey == 'm'){ timeCount+=parseFloat(inputValue); } } } if (timeCount > 1440){ alert('TRY AGAIN:\n\nThere are only 24 hours in a day - please re-calculate your figures!'); document.getElementById("theresponse").innerHTML = ''; } else{ timeLeft = (1440 - timeCount); totalHours = parseInt(timeLeft/60); totalMinutes = (timeLeft%60); var myResponse = ('<b>Based on these calculations, you have a maximum of ' + totalHours + ' hours and ' + totalMinutes + ' minutes free time for this course.</b>'); if (document.getElementById){ document.getElementById("theresponse").innerHTML = myResponse; } else { alert ('myReponse') } } return false; } //--> </script> Thanks in advance for any help, Fergal When I run the following code in IE9 it will not display the warning text but it will change the input box color any suggestions to get this to work would be helpful. Code: <style> input.valid { background: #afa; } input.invalid { background: #faa; } .show {visibility: visible; color: #FF0000;} .disappear {visibility: hidden;} </style> Code: <SCRIPT type="text/JavaScript"> <!-- // hide from older browsers function confirm_password() { if (document.userinfo.password.value == document.userinfo.passwordconf.value) { document.userinfo.passwordconf.className = "valid"; //Greenish background color document.getElementById('span1').className = "disappear"; } else { document.userinfo.passwordconf.className = "invalid"; //Reddish background color document.getElementById('span1').className = "show"; } } // --> </SCRIPT> Code: <form name="userinfo" method="POST" action="#"> Email: <input type="text" name="email"><br> Password: <input type="password" name="password"><br> Confirm Password: <input type="password" name="passwordconf" onClick="confirm_password()" onFocus="confirm_password()" onChange="confirm_password()" onKeyUp="confirm_password()" onBlur="confirm_password()"><span id="span1" class="disappear">Warning Passwords to not match!</span><br> <input type="submit" name="submit" value="submit"> </form> |