JavaScript - Jcarousel Is Not Working Properly At My Site
Hello,
We have jcarousel on our forum site which rotates automatically. It is vbulletine forum. In fact originally it was working fine with old design and rotating images automatically in horizontal direction with a set of 5 images visible at a time and total 12 images in set. But we have upgraded our forum design in last week and I started getting issues with Jcarousel scroller. Our site URL is http://newtest.naturalparenting.com.au Please go at any topic and post page finally, Below first post there is a scroller e.g http://newtest.naturalparenting.com....ad.php?t=42713 While old site design is still active at http://ninad.naturalparenting.com.au Please go at any topic and post page finally, Below first post there is a scroller e.g http://ninad.naturalparenting.com.au...ad.php?t=40745 At new design when we implemented jcarousel scroller it is showing only one image in a horizontal row at jscroller and it disappears immediately and after 3-4 min it do reappear again. When I inspected it using firebug I have noticed that other images are coming below vertically not horizontally, really strange. Also I noticed another thing is that it is not updating width at element.style in firebug for UL tag. It is showing fix width 220 px all time. I think due to that all images appearing vertically one after one rather than horizontally. It is really very strange issue for me. I have tried all ways to fix it but alas !!! Any help would be greatly appreciated. Code: <style type="text/css"> .jcarousel-skin-tango .jcarousel-container { -moz-border-radius: 0px; background: transparent; border: 0px solid #CEC8B7; } .jcarousel-skin-tango .jcarousel-direction-rtl { direction: rtl; } .jcarousel-skin-tango .jcarousel-container-horizontal { width: 695px; padding: 20px 30px; } .jcarousel-skin-tango .jcarousel-container-vertical { width: 75px; height: 220px; padding: 40px 20px; } .jcarousel-skin-tango .jcarousel-clip-horizontal { height: 220px; margin-left: auto; margin-right: auto; width: 675px; } .jcarousel-skin-tango .jcarousel-clip-vertical { width: 75px; height: 220px; } .jcarousel-skin-tango .jcarousel-item { width: 75px; height: 75px; } .jcarousel-skin-tango .jcarousel-item-horizontal { margin-left: 0; margin-right: 10px; } .jcarousel-skin-tango .jcarousel-direction-rtl .jcarousel-item-horizontal { margin-left: 10px; margin-right: 0; } .jcarousel-skin-tango .jcarousel-item-vertical { margin-bottom: 10px; } .jcarousel-skin-tango .jcarousel-item-placeholder { background: #fff; color: #000; } /** * Horizontal Buttons */ .jcarousel-skin-tango .jcarousel-next-horizontal { position: absolute; top: 83px; right: 5px; width: 32px; height: 32px; cursor: pointer; /* background: transparent url(images/checkout/nivo_nav.png) no-repeat scroll right top;*/ } .jcarousel-skin-tango .jcarousel-direction-rtl .jcarousel-next-horizontal { left: 5px; right: auto; background: transparent url(images/checkout/nivo_nav.png) no-repeat scroll right top; } .jcarousel-skin-tango .jcarousel-next-horizontal:hover { background-position: -32px 0; } .jcarousel-skin-tango .jcarousel-next-horizontal:active { background-position: -64px 0; } .jcarousel-skin-tango .jcarousel-next-disabled-horizontal, .jcarousel-skin-tango .jcarousel-next-disabled-horizontal:hover, .jcarousel-skin-tango .jcarousel-next-disabled-horizontal:active { cursor: default; background-position: -96px 0; } .jcarousel-skin-tango .jcarousel-prev-horizontal { position: absolute; top: 83px; left: 5px; width: 31px; height: 31px; cursor: pointer; /*background: transparent url(images/checkout/nivo_nav.png) no-repeat scroll left top;*/ } .jcarousel-skin-tango .jcarousel-direction-rtl .jcarousel-prev-horizontal { left: auto; right: 31px; /*background-image: url(images/checkout/nivo_nav.png);*/ } .jcarousel-skin-tango .jcarousel-prev-horizontal:hover { background-position: -32px 0; } .jcarousel-skin-tango .jcarousel-prev-horizontal:active { background-position: -64px 0; } .jcarousel-skin-tango .jcarousel-prev-disabled-horizontal, .jcarousel-skin-tango .jcarousel-prev-disabled-horizontal:hover, .jcarousel-skin-tango .jcarousel-prev-disabled-horizontal:active { cursor: default; background-position: -96px 0; } /** * Vertical Buttons */ .jcarousel-skin-tango .jcarousel-next-vertical { position: absolute; bottom: 5px; left: 43px; width: 32px; height: 32px; cursor: pointer; background: transparent url(next-vertical.png) no-repeat 0 0; } .jcarousel-skin-tango .jcarousel-next-vertical:hover { background-position: 0 -32px; } .jcarousel-skin-tango .jcarousel-next-vertical:active { background-position: 0 -64px; } .jcarousel-skin-tango .jcarousel-next-disabled-vertical, .jcarousel-skin-tango .jcarousel-next-disabled-vertical:hover, .jcarousel-skin-tango .jcarousel-next-disabled-vertical:active { cursor: default; background-position: 0 -96px; } .jcarousel-skin-tango .jcarousel-prev-vertical { position: absolute; top: 5px; left: 43px; width: 32px; height: 32px; cursor: pointer; background: transparent url(prev-vertical.png) no-repeat 0 0; } .jcarousel-skin-tango .jcarousel-prev-vertical:hover { background-position: 0 -32px; } .jcarousel-skin-tango .jcarousel-prev-vertical:active { background-position: 0 -64px; } .jcarousel-skin-tango .jcarousel-prev-disabled-vertical, .jcarousel-skin-tango .jcarousel-prev-disabled-vertical:hover, .jcarousel-skin-tango .jcarousel-prev-disabled-vertical:active { cursor: default; background-position: 0 -96px; } #upsell { margin-bottom: 10px; margin-top: 0; text-align: center; } #upsell li { border: 0 dashed #CCCCCC; float: left; height: 220px; list-style: none outside none; margin: 0 10px 0 0; padding: 2px; width: 125px; } </style> <script type="text/javascript" src="/resources/scripts/jquery-1.4.2.min.js"></script> Similar TutorialsHi i have a question and i would really appreciate the help of fellow coders. I came across a certain horizontal jcarousel on the website http://www.goal.com , i would like to know how this was done as i would like to use this type of jcarousel for my websites homepage . i would really appreciate the help of you guys .
http://sorgalla.com/projects/jcarousel/ I would like to use this jcarousel. I dont use AJAX, I just want to set it up with script in my head and html on my website. Is this possible or do I have ot use AJAX? I am not familiar with it at all.. I completed the steps it said. I put the folder in my directory. I added the script to my head code, as well as the other one. I then also added the other two scripts in my html where I would like them to be. It's not showing up so I know I am missing steps or not doing it correctly Help anyone? THANK YOU!!! Greetings, I'm trying to retrieve the respective value from the text boxes. Unfortunate the value i retrieve and added always point to the first text box. Can anyone out there help me with these. Thanks in advance. Code: <td align='center'> <input name='txtQty[]' type='text' id='txtQty[]' size='5' value='$od_qty' class='box'/><br></br> <input type='image' name='btnAdd' src='library/cart add.png' onclick=\"document.getElementById('txtQty[]').value++;\"/> <input type='image' name='btnSubtract' src='library/cart remove.png' onclick=\"document.getElementById('txtQty[]').value--;\"/> <input name='hidTpcd[]' type='hidden' value='$od_tpcd'/> </td> Regards, Juz Hello There! I am fairly new to javascript and am in need of some help. I am trying to make a simple script that tells you what class period it is. I've gotten everything working except for the If statement that tells you what period it is. I can't figure out if i'm doing something wrong, and it's starting to drive me insane. Here's the code for the script. I've tried to comment it as much as possible to make it easy to understand. Code: //define variables //Get current time var currentTime = new Date(); var hours = currentTime.getHours(); var minutes = currentTime.getMinutes(); //First period var period1 = prompt("Please enter your First Period Class","Ex: Science"); console.log ("First period is: " +period1+ "." ); //Second Period var period2 = prompt("Please enter your Second Period Class","Ex: PE"); console.log ("Second period is: " +period2+ "." ); //Third Period var period3 = prompt("Please enter your Third Period Class","Ex: Language Arts"); console.log ("Third period is: " +period3+ "." ); //Fourth Period var period4 = prompt("Please enter your Fourth Period Class","Ex: Math"); console.log ("Fourth period is: " +period4+ "." ); //Fifth Period var period5 = prompt("Please enter your Fifth Period Class","Ex: MSI"); console.log ("Fifth period is: " +period5+ "." ); //Sixth Period var period6 = prompt("Please enter your Sixth Period Class","Ex: Band"); console.log ("Sixth period is: " +period6+ "." ); //Seventh period var period7 = prompt("Please enter your Seventh Period Class","Ex: History"); console.log ("Seventh period is: " +period7+ "." ); //If minutes are less than 10 add zero before number if (minutes < 10){ minutes = "0" + minutes; } //Add a blank Line console.log (); //Show Current time console.log ("Current time is " + hours + ":" + minutes); //Define variable time var time = (hours + "." + minutes); //Before School if (time >= 0.01 & time <= 7.40) console.log ("School hasn't started yet."); //After School if (time >= 3.20 & time <= 0.00) console.log ("School is over."); This is all that i've gotten so far. I haven't filled in any of the other periods, because this problem is driving me insane! Thank you for your help. --Tab00 Hi All, I had to switch to Mootools, because the current company I am working for uses MooTools. Till thus far I haven't had any problems with MooTools until about 10min ago. I am using a plug in called noobSlide, You can check it out here http://www.efectorelativo.net/laboratory/noobSlide/ My problem is that for some or other reason it displays 5 images instead of 4 images(the amount I am using), leaving the lastly displayed image blank. Code: Head: <link rel="stylesheet" type="text/css" href="./css/liquidstyle.css" /> <link rel="stylesheet" type="text/css" href="./css/screen.menumatic.css" /> <link rel="stylesheet" type="text/css" href="./css/jd.gallery.css" /> <script src="../root/scripts/core.js" type="text/javascript"></script> <script src="../root/scripts/mootools-1.2.1-core.js" type="text/javascript"></script> <script src="../root/scripts/mootools-1.2-more.js" type="text/javascript"></script> <script src="../root/scripts/menumatic.js" type="text/javascript"></script> <script src="../root/scripts/com_form.js" type="text/javascript"></script> <script src="../root/scripts/com_list.js" type="text/javascript"></script> <script src="../root/scripts/com_panel.js" type="text/javascript"></script> <script src="../root/scripts/com_tab.js" type="text/javascript"></script> <script src="../root/scripts/roar.js" type="text/javascript"></script> <script src="../root/scripts/jd.gallery.js" type="text/javascript"></script> <script src="../root/scripts/jd.gallery.transitions.js" type="text/javascript"></script> <script src="../root/scripts/_class.noobSlide.packed.js" type="text/javascript"></script> Code: page: <script type="text/javascript"> window.addEvent('domready',function(){ var nS2 = new noobSlide({ box: $('box2'), size: 945, items: [0,1,2,3,4], interval: 3000, fxOptions: { duration: 2500, transition: Fx.Transitions.Bounce.easeOut, wait: false }, addButtons: { previous: $('prev1'), next: $('next1') } }); }); </script> Code: HTML: <div class="mask2"> <div id="box2"> <span class="sShow"><img src="images/branding_your_website/img_1.jpg" alt="Photo" /></span> <span class="sShow"><img src="images/branding_your_website/img_2.jpg" alt="Photo" /></span> <span class="sShow"><img src="images/branding_your_website/img_3.jpg" alt="Photo" /></span> <span class="sShow"><img src="images/branding_your_website/img_4.jpg" alt="Photo" /></span> </div> </div> <p class="buttons"> <span id="prev1"><< Previous</span> <span id="next1">Next >></span> </p> Thanks in advance Hi, While i am binding a value to a text box using java script. It will properly in all browsers other than IE. In IE the value bind as 'undefined' in the text box . so please provide solution for this one. The code sample is given below. In this "Flight Search " is the text box id . I have to bind that value from the previous page selected value. function SelectAirport(val) { var id = val + "_lnkCity"; var lnk = document.getElementById(id); window.opener.document.getElementById("FlightSearch").value = lnk.text; window.opener.document.getElementById("destinationSearch").value = lnk.text; window.close(); } Hi guys, I am having a problem where the sorting function I have designed is supposed to sort an array of records into descending order in terms of each record's "score" value, I would expect the below code to alert 2,1,0 in that order but it's as if the code didn't even sort it. Help would greatly be appreciated Code: var g=[{sco 0,index:0},{sco 2,index:1},{sco 1,index:2}] function sortScores(scoreRecs){ var swapped; do for(i=0;i<scoreRecs.length-1;i++){ if(scoreRecs[i].score<scoreRecs[i+1].score){ var a=scoreRecs[i] var b=scoreRecs[i+1] var c=a; a=b; b=c; swapped=true; } else{ swapped=false; } } while(swapped==true) } sortScores(g); alert(g[0].score); alert(g[1].score); alert(g[2].score); Hi, I am having a strange problem. I have a javascript that I am running on my system and on server(both in IE and FF). The problems I am encountering are as follows: My system IE - everything working fine FF - Not able to set focus correctly. When focus() is called, it jumps to next field. On Server IE - Focus doesnt set as expected. No blinking cursor.Doesnt do anything. FF- Same thing as above. When focus functionality is called, nothing happens. It is a long javascript, but here is a snapshot of the code with problem. Please let me know if you want to know about any variables. The (fname,lname..)are all the Name attributes of textbox. userArray is a array containg the number of users whose information is not filled up correctly(ie. some reqd fields are left empty). Code: df=document.form; for(var j=0;j< val;j++) { if(df['fname'+userArray[j]].value =="") { df['fname'+userArray[j]].focus(); break; } else if(df['lname'+userArray[j]].value =="") { df['lname'+userArray[j]].focus();break; } else if(df['ph'+userArray[j]].value =="") { df['ph'+userArray[j]].focus();break; } else if(df['email'+userArray[j]].value =="") { df['email'+userArray[j]].focus();break; } else if(df['comp'+userArray[j]].value =="") { df['comp'+userArray[j]].focus();break; } else if(df['addra'+userArray[j]].value =="") { df['addra'+userArray[j]].focus();break; } else if(df['city'+userArray[j]].value =="") { df['city'+userArray[j]].focus();break; } else if(df['state'+userArray[j]].value =="") { df['state'+userArray[j]].focus();break; } else if(df['zip'+userArray[j]].value =="") { df['zip'+userArray[j]].focus();break; } else if(df['country'+userArray[j]].value =="") { df['country'+userArray[j]].focus();break; } } The code is definitely not clean,pls forgive me for that. Any suggestion on that will be appreciated. Thanks I have 2 tables with Add/Remove Row buttons. The first table's Add Row button adds a row that belongs in the second table, and the Remove Row button gives me an Object Error. The second table works properly. The JavaScript for both tables is identical except for the ID's. When the tables are put into seperate html files both of the Add buttons work properly, but the remove row button from table one is still giving me the Object Error. Can someone point out what i'm doing wrong? Thanks. Code for the first table Code: <SCRIPT language="javascript"> function addRow(kodaktable) { var table = document.getElementById(kodaktable); var rowCount = table.rows.length; var row = table.insertRow(rowCount); var cell1 = row.insertCell(0); var element1 = document.createElement("input"); element1.type = "checkbox"; cell1.appendChild(element1); var cell2 = row.insertCell(1); var element2 = document.createElement("input"); element2.type = "text"; cell2.appendChild(element2); var cell3 = row.insertCell(2); var element2 = document.createElement("input"); element2.type = "text"; cell3.appendChild(element2); var cell4 = row.insertCell(2); var element2 = document.createElement("input"); element2.type = "text"; cell4.appendChild(element2); var cell5 = row.insertCell(2); var element2 = document.createElement("input"); element2.type = "text"; cell5.appendChild(element2); var cell6 = row.insertCell(2); var element2 = document.createElement("input"); element2.type = "text"; cell6.appendChild(element2); } </script> <script> function deleteRow(kodaktable) { try { var table = document.getElementById(kodaktable); var rowCount = table.rows.length; for(var i=0; i<rowCount; i++) { var row = table.rows[i]; var chkbox = row.cells[0].childNodes[0]; if(null != chkbox && true == chkbox.checked) { table.deleteRow(i); rowCount--; i--; } } }catch(e) { alert(e); } } </SCRIPT> <INPUT type="button" value="Add Row" onClick="addRow('kodaktable')" /> <INPUT type="button" value="Delete Row" onClick="deleteRow('kodaktable')" /> <TABLE id="kodaktable" width="350px" border="1"> <TR> <tr> <th></th> <th>Job Name</th> <th>Job Number</th> <th>Start Doc</th> <th>End Doc</th> <th>Total</th> </tr> <tr> <td><INPUT type="checkbox" name="chk"/></td> <td><input type="text" name="name" /></td> <td><input type="text" name="name" /></td> <td><input type="text" name="name" /></td> <td><input type="text" name="name" /></td> <td><input type="text" name="name" /></td> </tr> </TR> </TABLE> code for the second table. Code: <SCRIPT language="javascript"> function addRow(incidenttable) { var table = document.getElementById(incidenttable); var rowCount = table.rows.length; var row = table.insertRow(rowCount); var cell1 = row.insertCell(0); var element1 = document.createElement("input"); element1.type = "checkbox"; cell1.appendChild(element1); var cell2 = row.insertCell(1); var element2 = document.createElement("input"); element2.type = "text"; element2.size = "70"; cell2.appendChild(element2); var cell3 = row.insertCell(2); var element2 = document.createElement("input"); element2.type = "text"; element2.size = "20"; cell3.appendChild(element2); var cell4 = row.insertCell(2); var element2 = document.createElement("input"); element2.type = "text"; element2.size = "20"; cell4.appendChild(element2); } function deleteRow(incidenttable) { try { var table = document.getElementById(incidenttable); var rowCount = table.rows.length; for(var i=0; i<rowCount; i++) { var row = table.rows[i]; var chkbox = row.cells[0].childNodes[0]; if(null != chkbox && true == chkbox.checked) { table.deleteRow(i); rowCount--; i--; } } }catch(e) { alert(e); } } </SCRIPT> <INPUT type="button" value="Add Row" onClick="addRow('incidenttable')" /> <INPUT type="button" value="Delete Row" onClick="deleteRow('incidenttable')" /> <table id="incidenttable" width="790px" border="1"> <tr> <th></th> <th>Incident</th> <th>Kodak Downtime</th> <th>System Downtime</th> </tr> <tr> <td><INPUT type="checkbox" name="chk"/></td> <td><input type="text" name="name" size="70" /></td> <td><input type="text" name="name" size="20"></td> <td><input type="text" name="name" size="20"></td> </tr> </table> Hello, i am a total newbie, so forgive me i have the following problem: a Joomla Gallery uses a javascript to show fullsize images. but when the popup windows comes out, it doesn't have any properties (page title, url about:blank, blank background etc) here is a screenshot: I think the following to be the code that calls the popup: what's wrong? NOTE I already had to remove some "spaces" from the code because the Joomla SEF was changing the urls forbidding the right execution of everything, maybe it's something like that... dunno :cry: Code: $htmltext2 .= "<script language=\"JavaScript\">"; $htmltext2 .= "function pgpopup(pgimagefile,pgimagetitle,pgimagedescription) {\n"; $htmltext2 .= "var newWindow = window.open(\"\",\"newWindow\",\"height=" . ($tabparams["pgmaxheight"]+$dparm[2]) . ",width=" . ($tabparams["pgmaxwidth"]+$dparm[3]) . ",resizable=yes, scrollbars=yes, toolbar=no " . "\" );\n"; $htmltext2 .= "var imageurl = \"<img src= \"+ pgimagefile + \">\";\n"; $htmltext2 .= "newWindow.document.open();"; $htmltext2 .= "newWindow.document.writeln(\"<div align='center' >\");\n"; $htmltext2 .= "newWindow.document.writeln(\"<title>Profile Gallery Image: \"+ pgimagetitle + \"</title>\");\n"; $htmltext2 .= "newWindow.document.writeln(imageurl);\n"; $htmltext2 .= "newWindow.document.writeln(\"<br />\");"; $htmltext2 .= "newWindow.document.writeln(pgimagedescription);\n"; $htmltext2 .= "newWindow.document.writeln(\"</div>\");\n"; $htmltext2 .= "newWindow.document.close();\n"; $htmltext2 .= "}\n"; $htmltext2 .= "</script>"; break; anyone can help? thanks! Jquery, Jcarousel problems - want it to go back to the start and then stop Here is the link - I want it to go from the last - which would be the 3rd image and swoosh back to the beginning and stop. my alternative is already uploaded where I have it just go to the 4th which is the same at the first.. Help it would look nicer with it swooshing back to the beginning and stopping. http://www.macrojump.com/sti_demo/home.php Code: $(document).ready( function() { function carouselInit(carousel) { $('.level0-hero-carousel .carousel-control a').bind('click', function() { carousel.scroll( parseInt( $(this).attr('rel') ) ); carousel.stopAuto(); return false; }); carousel.clip.hover(function() { //carousel.stopAuto(); }, function() { //carousel.startAuto(); }); }; function firstItemAction(carousel, item, idx, state) { $('.level0-hero-carousel .carousel-control a').removeClass('active').eq(idx-1).addClass('active'); }; $('.level0-hero-carousel').jcarousel({ scroll: 1, initCallback: carouselInit, itemFirstInCallback: firstItemAction, auto: 4, wrap: 'first', animation: 1500, buttonNextHTML: null, buttonPrevHTML: null }); if( $('.level0-hero-carousel ul li').size() > 1 ) $('.level0-hero-carousel .carousel-control').show(); $('.level0-hero-carousel .carousel-control a').hover(function() { $(this).addClass('hover'); }, function() { $(this).removeClass('hover'); }); /* Alerts */ $('.level0-alerts ul li').eq(0).show(); var alertsInterval = null; var alertsIndex = 0; var alertsIntervalLength = 1500; var alertsCount = $('.level0-alerts ul li').size(); var expandedSizeClass = 'level0-alerts-expanded-' + alertsCount; // Update NumAlerts Text $('.level0-alerts .alerts-toggle span').text( alertsCount + ' Alerts' ); $('.level0-alerts .alerts-controls .alerts-toggle').bind('click', function() { var itemsCount = $('.level0-alerts ul li').size(); if( $('.level0-alerts').hasClass('level0-alerts-expanded') ) { $('.level0-alerts').removeClass('level0-alerts-expanded'); $('.level0-alerts').removeClass(expandedSizeClass); switchAlert(); startAlertsInterval(); } else { $('.level0-alerts').addClass('level0-alerts-expanded'); $('.level0-alerts').addClass(expandedSizeClass); $('.level0-alerts ul li').show(); stopAlertsInterval(); } return false; }); var switchAlert = function() { $('.level0-alerts ul li').hide(); alertsIndex++; $('.level0-alerts ul li').eq(alertsIndex % alertsCount).show(); } var startAlertsInterval = function() { if(alertsInterval == null) alertsInterval = setInterval(switchAlert, alertsIntervalLength); } var stopAlertsInterval = function() { if(alertsInterval != null) { clearInterval(alertsInterval); alertsInterval = null; } } if(alertsCount > 1) { $('.level0-alerts .alerts-controls').show(); startAlertsInterval(); } }); /* * jQuery Placeholder Plug-in * * Copyright (c) 2010 Max Davis * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * Revision: 1 * Version: 0.1 * * v0.1 * - First public release * */ (function($){ $.fn.placeholder = function() { $(this).each( function() { if($(this).attr("type") == "password") { var original_pass_field = $(this); if(original_pass_field.val() == "") { $(this).parent().append("<input type=\"text\" value=\""+ $(this).attr("placeholder") +"\" name=\"pass_placeholder\" class=\"form-text placeholder-inactive\" id=\"pass_placeholder\">"); $(this).css("display","none"); } var original_pass_field = $(this); $("#pass_placeholder").focus(function() { if(original_pass_field.val() == "") { $("#pass_placeholder").css("display","none"); original_pass_field.css("display",""); original_pass_field.focus(); } }); original_pass_field.blur(function() { if(original_pass_field.val() == "") { $("#pass_placeholder").css("display",""); original_pass_field.css("display","none"); } }); } else { if($(this).val() === "") { $(this).val($(this).attr("placeholder")); $(this).addClass('placeholder-inactive'); } $(this).focus(function() { if($(this).val() === $(this).attr("placeholder")) { $(this).removeClass('placeholder-inactive').addClass('placeholder-active'); $(this).val(""); } }).blur(function() { if($(this).val() === "") { $(this).removeClass('placeholder-active').addClass('placeholder-inactive'); $(this).val($(this).attr("placeholder")); } }); } } ) } })(jQuery); I have an "animated slideshow" of 29 jpeg images on a page created using Javascript. It works fine in Internet Explorer and Firefox but not Safari or Chrome. The jpeg files names are 01.jpg through to 29.jpg. Here below is the code in the header and the body. There is an error in there somewhe <html> <head> <title>My webpage</title> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <SCRIPT language="JavaScript" type="text/JavaScript"> <!-- var speed=1333; var counter = 1; function rollPics() { document.display.src=counter+".jpg"; //Display image "counter".jpg counter ++; // Add 1 to counter if (counter>29) { // If counter is greater than 29 images then reset it counter=1 } } <!-- END --> </SCRIPT> </head> <body> <center> <table> <tr><td> <IMG NAME="display" SRC="1.jpg" onLoad="setTimeout('rollPics()',1333)"> </td></tr> </table> </center> </body> </html> for(var i=0; i<orderItemIndex; i++){ document.writeln('<tr>'); } document.writeln('<td>' + orderItemIndex[0] + '</td>'); document.write('<td>' + productName[0] + '</td>'); document.write('<td> $' + sausagePrice + '</td>'); document.write('<td> ' + orderItemQty[0] + '</td>'); document.write('<td> ' + sausageTotal + '</td>'); document.writeln('</tr>'); } orderItemIndex is an array with user inputs in it, I'm trying to make a new row for each individual array, the table is creating correctly but the loop is not working, if several inputs are added it just outputs the last input to one row, instead of making a new one each time, what am I missing? (The code above has other problems I know but I'm working on this first) Reply With Quote 01-07-2015, 06:50 PM #2 sunfighter View Profile View Forum Posts Senior Coder Join Date Jan 2011 Location Missouri Posts 4,830 Thanks 25 Thanked 672 Times in 671 Posts document.write() is a horrible way to do anything. It certainly will not insert anything, what it does is over write anything on your page so if you have a table defined with HTML the document.write() will wipe it out. Look at HTML DOM Table insertRow() Method Hello, I am building a shopping cart website that is using a mega javascript dropdown menu. Everything was working fine until you get to the checkout page on the website. The checkout page has this accordian / spry deal where customers can checkout on one page. You can view it he http://gem-tech.com.mytempweb.com/store/pc/onepagecheckout.asp If I take the menu code out of the header.asp file, then the checkout page works just fine. But if I put the menu code back in, then the checkout page stops working. Here is the menu code (simplified it a bit for this thread): Quote: <head> <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script> </head> Quote: <body><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <script type="text/javascript" src="jquery.hoverIntent.minified.js"></script> <script type="text/javascript"> $(document).ready(function() { function megaHoverOver(){ $(this).find(".sub").stop().fadeTo('fast', 1).show(); //Calculate width of all ul's (function($) { jQuery.fn.calcSubWidth = function() { rowWidth = 0; //Calculate row $(this).find("ul").each(function() { rowWidth += $(this).width(); }); }; })(jQuery); if ( $(this).find(".row").length > 0 ) { //If row exists... var biggestRow = 0; //Calculate each row $(this).find(".row").each(function() { $(this).calcSubWidth(); //Find biggest row if(rowWidth > biggestRow) { biggestRow = rowWidth; } }); //Set width $(this).find(".sub").css({'width' :biggestRow}); $(this).find(".row:last").css({'margin':'0'}); } else { //If row does not exist... $(this).calcSubWidth(); //Set Width $(this).find(".sub").css({'width' : rowWidth}); } } function megaHoverOut(){ $(this).find(".sub").stop().fadeTo('fast', 0, function() { $(this).hide(); }); } var config = { sensitivity: 2, // number = sensitivity threshold (must be 1 or higher) interval: 100, // number = milliseconds for onMouseOver polling interval over: megaHoverOver, // function = onMouseOver callback (REQUIRED) timeout: 500, // number = milliseconds delay before onMouseOut out: megaHoverOut // function = onMouseOut callback (REQUIRED) }; $("ul#topnav li .sub").css({'opacity':'0'}); $("ul#topnav li").hoverIntent(config); }); </script> </body> And there are two things of script on the onepagecheckout.asp page as well. Here they a Quote: <script type="text/javascript"> $(document).ready(function() { $('#chkPayment').click(); }); </script> Quote: <script type="text/javascript"> var acc1 = new Spry.Widget.Accordion("acc1", { useFixedPanelHeights: false, enableAnimation: false }); var currentPanel = 0; <% if session("idCustomer")>"0" then session("OPCstep")=2 else session("OPCstep")=0 end if %> //* Find Current Panel <% if len(Session("CurrentPanel"))=0 AND pcv_strPayPanel="" then %> <% if session("idCustomer")>"0" then %> acc1.openPanel('opcLogin'); GoToAnchor('opcLoginAnchor'); $('#LoginOptions').hide(); $('#ShippingArea').hide(); $('#BillingArea').show(); <% else %> $('#LoginOptions').show(); $('#acc1').hide(); <% end if %> <% else %> <% If pcv_strPayPanel = "1" Then %> $(document).ready(function() { $('#LoginOptions').hide(); pcf_LoadPaymentPanel(); }); <% Else %> acc1.openPanel('opcLogin'); $('#LoginOptions').hide(); $('#ShippingArea').hide(); $('#BillingArea').show(); <% End If %> <% end if %> GoToAnchor('opcLoginAnchor'); function openme(pNumber) { acc1.openPanel(pNumber); } function toggle(pNumber) { var ele = acc1.getCurrentPanel(); var panelNumber = acc1.getPanelIndex(ele); if (panelNumber == pNumber) { acc1.closePanel(pNumber); } else { acc1.openPanel(pNumber); } } function togglediv(id) { var div = document.getElementById(id); if(div.style.display == 'block') div.style.display = 'none'; else div.style.display = 'block'; } function win(fileName) { myFloater=window.open('','myWindow','scrollbars=yes,status=no,width=300,height=250') myFloater.location.href=fileName; } </script> Any help would be GREATLY appreciated, Thank you I made a php page with multiple forms with javascript code in it. The javascript makes an input field for the date. The problem is that the script interfers between other scripts in the other forms and i get wrong orderdate. Code: <form action='dataadd.php' name='$id'>"; $datestime=time(); echo "<input type=hidden name=dateid value='$id'>"; echo "<input type=hidden name=datestime value='$datestime'>";?> <script type="text/javascript"> DateInput('orderdate', true, 'yyyy-mm-dd')</script>.... hi Pals, I have a problem regarding the "target" attribute of "a" tag. in my code I use biggerlink jQuery script to give link to p element without come HTML validation problem. I pass the "target" value from PHP to smarty template , but it's not working , When I remove "biggerlink " it works but the link in <p> tag not working . My Tpl file is : Code: {if not empty($campaign)} <div class="securti-adv biggerlink"> {if not empty ($campaign.media)} <a href="{$campaign.url}" {if n($campaign.linkTarget)}target="{$campaign.linkTarget}"{/if} class="thumb"> <img src="{$campaign.image}" title="{$campaign.title1 + $campaign.title2}" alt="{$campaign.title1 + $campaign.title2}" /> </a> {/if} <div class="details"> {if not empty ($campaign.title1) || not empty ($campaign.sub_title)} <a href="{$campaign.url}" {if not empty($campaign.linkTarget)}target="{$campaign.linkTarget}"{/if} title="{$campaign.title1 + $campaign.title2}"> {text2image styleSlug=$campaign.titleStyle1 text=$campaign.title1} {text2image styleSlug=$campaign.titleStyle2 text=$campaign.title2} <span><img src="{$imagesDir}/btn-campaign-meet-security-advisor.png" alt="" title="" /></span> </a> <p> {text2image styleSlug=$campaign.subtitleStyle text=$campaign.subTitle}</p> {/if} </div> </div> <script type="text/javascript" language="javascript"> {literal} $(document).ready(function(){ $('.biggerlink').biggerlink(); }); {/literal} </script> {/if} My plugin code is : Code: (function($) { $.fn.biggerlink = function(options) { // Default settings var settings = { hoverclass:'hover', // class added to parent element on hover clickableclass:'hot', // class added to parent element with behaviour follow: true // follow link? Set to false for js popups }; if(options) { $.extend(settings, options); } $(this).filter(function(){ return $('a',this).length > 0; }).addClass(settings.clickableclass).each(function(i){ // Add title of first link with title to parent $(this).attr('title', $('a[title]:first',this).attr('title')); // hover and trigger contained anchor event on click $(this) .mouseover(function(){ window.status = $('a:first',this).attr('href'); $(this).addClass(settings.hoverclass); }) .mouseout(function(){ window.status = ''; $(this).removeClass(settings.hoverclass); }) .bind('click',function(){ $(this).find('a:first').trigger('click'); }) // triggerable events on anchor itself .find('a').bind('focus',function(){ $(this).parents('.'+ settings.clickableclass).addClass(settings.hoverclass); }).bind('blur',function(){ $(this).parents('.'+ settings.clickableclass).removeClass(settings.hoverclass); }).end() .find('a:first').bind('click',function(e){ if(settings.follow == true) { window.location = this.href; } e.stopPropagation(); // stop event bubbling to parent }).end() .find('a',this).not(':first').bind('click',function(){ $(this).parents('.'+ settings.clickableclass).find('a:first').trigger('click'); return false; }); }); return this; }; })(jQuery); the value of "target" , "_blank" is not work .... I highlight the code part regarding this, please check and give me a solution ASAP. You can mail me at : anes.pa@gmail.com Thanks, Anes Hi,
I have designed a site. It's working properly in locally.
Now I want to insert a special javascript on my home page.
The job of that special javascript is, makes some errors in the site when site is going to publish on internet.
The site should run on locally but not on server I know that's a strange requirement . But that's a test for me... Is there any, this kind of special javascript...??? please help me. thanx Hi, I really need urgent help. I am using a javascript on a DotNetNuke CMS site to allow the user to choose text/background colour, basically it changes stylesheets. Here is the code that I have used: http://www.dynamicdrive.com/dynamici...etswitcher.htm and here is my example: http://lrptintranet.com.dnnmax.com/ - you can see the colour image buttons top right under the main menu. The style sheet changer seems to work on the top menu level items but as soon as you choose a submenu the javascript doesn't seem to work. I don't know anything at all about javascript - can anyone offer any advice how I can get this working on the sub menu pages?
I'l not good in Javascript and I can't find anything about what I want.. . On a sports website there is a table with our ranking and results. On this site the content is changed weekly, but it stays in the same tables.. . Is it possible to make a javascript to get those tables and put them on my own website so the content will change on my site when the content is changed on the sports site? Please help me, it would save me lot of time.. . THx Can someone please help me with my validation! I am a novice at Javascript and have started only learning it now as its a part of my course. I know its too long but i just put in the whole thing as the error might be anywhere. Code: <html> <head> <meta name="author" content="Trev - Cert IV in IT- Networking" /> <title>Univeristy Registration Form</title> <script language="javascript" type="text/javascript"> function Mainfunc() { var Fname = new Object(); var fn = new String(); Fname = document.getElementById ("text1"); fn=Fname.value; var Mname = new Object(); var mn = new String(); Mname = document.getElementById ("text2"); mn=Mname.value; var Lname = new Object(); var ln = new String(); Lname = document.getElementById ("text3"); ln=Lname.value; var Radd = new Object(); var radd = new String(); Radd = document.getElementById ("tarea1"); radd=Radd.value; var Dd = new Object(); var dd = new String(); Dd = document.getElementById ("text4"); dd=Dd.value; var ddd = parseInt (dd,10); if (dd!=ddd) { alert ("Please enter your Date of Birth!"); return false; } var Mm = new Object(); var mm = new String(); Mm = document.getElementById ("text5"); mm=Mm.value; var mmm = parseInt (mm,10); if (mm!=mmm) { alert ("Please enter your Month of Birth!"); return false; } var Yy = new Object(); var yy = new String(); Yy = document.getElementById ("text6"); yy=Yy.value; var yyy = parseInt (yy,10); if (yy!=yyy) { alert ("Please enter your Year of Birth!"); return false; } var Rphone = new Object(); var rp = new String(); Rphone = document.getElementById ("text7"); rp=Rphone.value; var rpp = parseInt (rp,10); if (rp!=rpp) { alert ("Please enter a valid Phone number!"); return false; } var Mphone = new Object(); var mp = new String(); Mphone = document.getElementById ("text8"); mp=Mphone.value; var mpp = parseInt (mp,10); if (mp!=mpp) { alert ("Please enter a valid Mobile number!"); return false; } var Course = new Object(); var course = new String(); Course = document.getElementById ("text9"); course=Course.value; var rad1; rad1=document.getElementById("radio1"); var rad2; rad2=document.getElementById("radio2"); var sel=document.getElementById("dept").value; var radgender; var chk1 = false; var chk2 = false; var chk3 = false; var rad1chk = false; var rad2chk = false; var genderpic; var chkbox1 = new Object(); chkbox1=document.getElementById("check1"); var chkbox2 = new Object(); chkbox2=document.getElementById("check2"); var chkbox3 = new Object(); chkbox3=document.getElementById("check3"); chk1 = chkbox1.checked; chk2 = chkbox2.checked; chk3 = chkbox3.checked; rad1chk = rad1.checked; rad2chk = rad2.checked; if ((rad1chk==false)&&(rad2chk==false)) { alert("Please select a gender!"); return false; } else if (rad1chk==true) { radgender = "Male"; document.write("<html>"); document.write("<head>"); document.write("<body bgcolor='aqua'>"); if ((chk1==true) && (chk2==false) && (chk3==false)) { document.write("<p style='font-family:arial black;color:blue;font-size:16px'> You have selected Campus A </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==false) && (chk2==true) && (chk3==false)) { document.write("<p style='font-family:arial black;color:blue;font-size:16px'>You have selected Campus B </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==false) && (chk2==false) && (chk3==true)) { document.write("<p style='font-family:arial black;color:blue;font-size:16px'>You have selected Campus C </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==true) && (chk2==true) && (chk3==false)) { document.write("<p style='font-family:arial black;color:blue;font-size:16px'>You have selected Campus A and B </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==true) && (chk2==false) && (chk3==true)) { document.write("<p style='font-family:arial black;color:blue;font-size:16px'>You have selected Campus A and C </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==false) && (chk2==true) && (chk3==true)) { document.write("<p style='font-family:arial black;color:blue;font-size:16px>You have selected Campus B and C </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==true) && (chk2==true) && (chk3==true)) { document.write("<p style='font-family:arial black;color:blue;font-size:16px'>You have selected Campus A,B and C </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==false) && (chk2==false) && (chk3==false)) { alert("Please select a campus"); } genderpic=document.write("<img src='E:/modifying/tf.jpg'>"); document.write("<br/>"); document.write("<p style='font-family:arial black;color:blue;font-size:16px'>You are a: " + radgender + "</p>"); document.write("<br/>"); if ((fn=" ")||(mn=" ")||(ln=" ")) { alert("Please Enter your Full Name!"); return false; } else if ((fn!=" ")&&(mn!=" ")&&(ln!=" ")) { document.write("<p style='font-family:arial black;color:blue;font-size:16px'>Your full name is: " + fn + " " + mn + " " + ln + "</p>"); document.write("<br/>"); } document.write("<p style='font-family:arial black;color:blue;font-size:16px'>Your date of birth is: " + dd + "/" + mm + "/" + yy + "</p>"); document.write("<br/>"); if (radd=" ") { alert("Please enter Your Address!"); return false; } else if (radd!=" ") { document.write("<p style='font-family:arial black;color:blue;font-size:16px'>Your Residential Address is: " + radd + "</p>"); document.write("<br/>"); } document.write("<p style='font-family:arial black;color:blue;font-size:16px'>Your telephone number is: " + rp + "</p>"); document.write("<br/>"); document.write("<p style='font-family:arial black;color:blue;font-size:16px'>Your Mobile number is: " + mp + "</p>"); document.write("<br/>"); document.write("<p style='font-family:arial black;color:blue;font-size:16px'>Your department is: " + sel + "</p>"); document.write("<br/>"); if (course=" ") { alert("Please Enter the Name of your Course!"); return false; } else if (course!=" ") { document.write("<p style='font-family:arial black;color:blue;font-size:16px'>The name of your course is: " + course + "</p>"); document.write("<br/>"); } document.write("<a id='bktoform1' style='font-family:arial black;color:blue;font-size:16px' href='G:/modifying/registration_form_Trevlyn_Farrar_Yes.html' >Click here to go to the form (previous page) using hyperlink</a>"); document.write("<p id='bktoform2' style='font-family:arial black;color:blue;font-size:16px' onclick='window.history.back()'>Click here to go to the form (previous page) by just clicking this text</p>"); document.write("</body>"); document.write("</head>"); document.write("</html>"); } else { radgender = "Female"; document.write("<html>"); document.write("<head>"); document.write("<body bgcolor='pink'>"); if ((chk1==true) && (chk2==false) && (chk3==false)) { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'> You have selected Campus A </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==false) && (chk2==true) && (chk3==false)) { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>You have selected Campus B </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==false) && (chk2==false) && (chk3==true)) { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>You have selected Campus C </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==true) && (chk2==true) && (chk3==false)) { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>You have selected Campus A and B </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==true) && (chk2==false) && (chk3==true)) { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>You have selected Campus A and C </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==false) && (chk2==true) && (chk3==true)) { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>You have selected Campus B and C </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==true) && (chk2==true) && (chk3==true)) { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>You have selected Campus A,B and C </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==false) && (chk2==false) && (chk3==false)) { alert("Please select a campus"); } genderpic=document.write("<img src='E:/modifying/ms.jpg'>"); document.write("<br/>"); document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>You are a: " + radgender + "</p>"); document.write("<br/>"); if ((fn=" ")||(mn=" ")||(ln=" ")) { alert("Please Enter your Full Name!"); return false; } else if ((fn!=" ")&&(mn!=" ")&&(ln!=" ")) { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>Your full name is: " + fn + " " + mn + " " + ln + "</p>"); document.write("<br/>"); } document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>Your date of birth is: " + dd + "/" + mm + "/" + yy + "</p>"); document.write("<br/>"); if (radd=" ") { alert("Please enter Your Address!"); return false; } else if (radd!=" ") { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>Your Residential Address is: " + radd + "</p>"); document.write("<br/>"); } document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>Your telephone number is: " + rp + "</p>"); document.write("<br/>"); document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>Your Mobile number is: " + mp + "</p>"); document.write("<br/>"); document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>Your department is: " + sel + "</p>"); document.write("<br/>"); if (course=" ") { alert("Please Enter the Name of your Course!"); return false; } else if (course!=" ") { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>The name of your course is: " + course + "</p>"); document.write("<br/>"); } document.write("<a id='bktoform1' style='font-family:arial narrow;color:red;font-size:16px' href='G:/modifying/registration_form_Trevlyn_Farrar_Yes.html' >Click here to go to the form (previous page) using hyperlink</a>"); document.write("<p id='bktoform2' style='font-family:arial narrow;color:red;font-size:16px' onclick='window.history.back()'>Click here to go to the form (previous page) by just clicking this text</p>"); document.write("</body>"); document.write("</head>"); document.write("</html>"); } } </script> </head> <body> <script language="javascript" type="text/javascript"> var dt=new Date(); document.write("<p align='right'>"); document.write(dt ); document.write("</p>"); </script> <h1>Registration Form</h1> <form Name="Registration" ID="FORM1" action="" method=""> <table> <tr> <p> <td> 1. Select your gender</td> <td> <input type="radio" id="radio1" name="Gender" value="Male" /> Male <br /> <input type="radio" id="radio2" name="Gender" value="Female" /> Female <br /> </td> </p> </tr> <tr> <p> <td>2. First Name:</td> <td><input type="text" id="text1" name="Fname" value="" size="30" /></td> </p> </tr> <tr> <p> <td>3. Middle Name:</td> <td><input type="text" id="text2" name="Mname" value="" size="30"/></td> </p> </tr> <tr> <p> <td>4. Last Name:</td> <td><input type="text" id="text3" name="Lname" value="" size="30"/></td> </p> </tr> <tr> <p> <td>5. Date of Birth (dd/mm/yyyy):</td> <td><input type="text" id="text4" name="dd" value="" size="2"/>/ <input type="text" id="text5" name="mm" value="" size="2"/>/ <input type="text" id="text6" name="yy" value="" size="4"/></td> </p> </tr> <tr> <p> <td>6. Residential Address (Not P.O. Box) </td> <td><textarea rows="4" cols="40" id="tarea1"> </textarea><br /></td> </p> </tr> <tr> <p> <td>7. Residential Phone Number:</td> <td><input type="text" id="text7" name="Rphone" value="" /></td> </p> </tr> <tr> <p> <td>8. Mobile Phone Number:</td> <td><input type="text" id="text8" name="Mphone" value="" /></td> </p> </tr> <tr> <p> <td>9. Choose your campus: </td> <td><input type="checkbox" id="check1" name="Campus" value="A" />Campus A<br /> <input type="checkbox" id="check2" name="Campus" value="B" />Campus B<br /> <input type="checkbox" id="check3" name="Campus" value="C" />Campus C<br /></td> </p> </tr> <tr> <p> <td>9. Choose your Department:</td> <td><select id="dept"> <option value="Nothing. Please Select a department"> Choose an Option... </option> <option value="Applied and Physical Science"> Applied and Physical Science</option> <option value="Arts"> Arts</option> <option value="Business and Commerce"> Business and Commerce</option> <option value="Education"> Education</option> <option value="Humanities"> Humanities</option> <option value="Information Technology and Computing"> Information Technology and Computing</option> <option value="Mathematics"> Mathematics</option> <option value="Pharmaceutical Science and Medical Science"> Pharmaceutical Science and Medical Science</option> <option value="Theoretical Science"> Theoretical Science</option> </select></td> </p> </tr> <tr> <p> <td>10. Name of Course Enrolled in:</td> <td><input type="text" id="text9" name="Course" value="" size="70"/></td> </p> </tr> </table> <p> <input type="button" name="button1" id="Submit" value="Submit" /> <input type="reset" name="button2" id="button2" value="Reset" /> <input type="button" name="button3" id="Display" value="Display" onclick="Mainfunc()" > </p> </table> <a href="http://getfreestat.com" style="font-size:9px;">free hit counter</a><br><a href="http://getfreestat.com"><img src="http://getfreestat.com/count.php?c_style=69&id=1301322705" border=0 alt="free hit counter"></a><br> <h6 align="bottom">This Form was designed by Trevlyn Christopher Farrar</h6> </body> </html> |