JavaScript - Fancy Box Ie Issue
Okay I'm on the edge and about to jump...been on this for 2 hours now and i cant find a solution.
Yet again IE has become the biggest pain and i'm ready to hunt down bill gates and make him feel my pain. My portfolio is about done, but the fancybox i am using on the images is not working correctly. If you open my portfolio page in IE you'll see what i mean www.nickwestcott.com/portfolio i have absolutely no idea what is causing this, i have used fancybox before, this is literally insane please help Similar TutorialsI figured as long as I copied the code from the How To Use section here. http://fancybox.net/howto It would work... but it doesn't, and I have a 7 day deadline. Any suggestions or help? Hi all, I have added the Javascript Fancy Box to my each of the main images of site, when these main images are selected the fancy box works fine but for some reason all my other anchors when selected try to use this fancybox aswell? I understand that the source of my problems come from this peice of code: Code: <script type="text/javascript"> $(document).ready(function() { $("a").fancybox(); }); </script> but how do I alter it so its only the main images that are presented in the box? My site is www.kylehouston.com Also how do I remove the black background used when the fancy box opens? Thanks loads in advance!! Kyle Hey, have another question. I've made a basic website template, which I'm still working on, but I'd like to make it compatible with IE before I go any further. I'm having trouble with the drop down menu that is located in the top right section on the site...in the banner. It seems to work fine in FireFox (which is what I've built it for), Safari, and Chrome, but it will not work in Internet Explorer. Problem is....it doesn't hide the links, or "il" section. I was able to get it to do so, but then it would not let you select any of them...they would disappear as soon as you moved your mouse off of the top section, or "ul" i believe it's called. Here is the website link http://pmportfolio.net/tester and here is the CSS sheet for the menu http://pmportfolio.net/tester/dropdown.css I'm sure I'm probably missing some things as well as having things I don't need. I'm lost. Here is the code for the menu: Code: <div id="rgbar"> <div id="container"> <div id="specialtext"> <div id="gameselector"> <div class="menu"> <ul> <li><a href="#">Drop Down Links <ins> <table cellspacing="0" cellpadding="0"><tr><td> <ul> <li><a href="#" rel="nofollow" target='_blank'> First One</a></li> <li><a href="#" rel="nofollow" target='_blank'> Second One</a></li> <li><a href="#" rel="nofollow" target='_blank'> Third One</a></li> <li><a href="#" rel="nofollow" target='_blank'> Fourth One</a></li> </ul> </td></tr></table> </ins></a> </li> </ul> </div> </div> </div> </div> and here is the CSS Code: /* #rgbar { position:absolute; top:8px; left:0px; width:1180px; height:80px; border:0px; display:block; font-size:10px; font-family:Verdana, Arial, Helvetica, sans-serif; padding:0px; margin:0px; */ /* SPECIAL TEXT FORMATION */ #rgbar #container #specialtext { width:190px; text-align:center; font-size:10px; color:#FFFFFF; padding:4px 0px 0px 0px; font-weight: bold; } #rgbar ins { text-decoration:none; } #rgbar a, #rgbar a:link, #rgbar a:visited, #rgbar a:active, #rgbar a:hover { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; color: #ccc } /* remove all the bullets, borders and padding from the default list styling */ #rgbar #container #specialtext #gameselector .menu ul { padding:0; margin:0; list-style-type:none; } /* float the list to make it horizontal and a relative positon so that you can control the dropdown menu positon */ #rgbar #container #specialtext #gameselector .menu li { float:left; width:175px; position:relative; z-index:100; left:5; } /* style the links for the top level */ #rgbar #container #specialtext #gameselector .menu a, #rgbar #container #specialtext #gameselector .menu a:visited { display:block; text-align:left; font-size:10px; text-decoration:none; color:#000000; width:169px; height:16px; padding-left:4px; line-height:16px; background-color: #c8c8c8; background-image: url("images/dropbg.png"); border: 1px solid #000000; -moz-border-radius-topright: 2px; /* mozilla border radius */ -webkit-border-radius-topright: 2px; /* safari and chrome border radius */ border-radius-topright: 2px; /* opera border radius */ -moz-border-radius-topleft: 2px; /* mozilla border radius */ -webkit-border-radius-topleft: 2px; /* safari and chrome border radius */ border-radius-topleft: 2px; /* opera border radius */ } /* a hack so that IE5.5 faulty box model is corrected */ * html #rgbar #container #specialtext #gameselector .menu a, * html #rgbar #container #specialtext #gameselector .menu a:visited { width:175px; /* QUIRKS MODE */ /* w\idth:175px; */ /* VALID MODE */ w\idth:173px; } /* IE 6 to OPERA Switch */ html > body #rgbar #container #specialtext #gameselector .menu ul ul { p\osition:relative; d\isplay:none; top: 18px; left:-5; } /* style the table so that it takes no ppart in the layout - required for IE to work */ #rgbar #container #specialtext #gameselector .menu table { position:absolute; top:0; left:0; border-collapse:collapse; } /* style the second level links */ #rgbar #container #specialtext #gameselector .menu ul ul a, #rgbar #container #specialtext #gameselector .menu ul ul a:visited { text-align:left; background:#222; color:#bbb; height:auto; line-height:12px; padding:3px; width:167px; border:1px solid #000000; border-width:0 1px 1px 1px; -moz-box-shadow: inset 0 0 1em rgba(0, 0, 0, 0.8); -webkit-box-shadow: inset 0 0 1em #000000; box-shadow: inset 0 0 1em #000000; -moz-border-radius: 0px; /* mozilla border radius */ -webkit-border-radius: 0px; /* safari and chrome border radius */ border-radius: 0px; /* opera border radius */ } #rgbar #container #specialtext #gameselector .menu ul ul li.last, #rgbar #container #specialtext #gameselector .menu ul ul li.last:visited { text-align:left; background:#000000; color:#bbb; height:auto; line-height:12px; padding:0; width:171px; w\idth:173px; border:1px solid #555; border-width:0 1px 1px 1px; b\order-width:0 1px 1px 1px; } #rgbar #container #specialtext #gameselector .menu ul ul li.last a, #rgbar #container #specialtext #gameselector .menu ul ul li.last:visited a:visited { border: 0px; width: 173px; w\idth: 166px; } /* yet another hack for IE5.5 */ * html #rgbar #container #specialtext #gameselector .menu ul ul a, * html #rgbar #container #specialtext #gameselector .menu ul ul a:visited { width:175px; /* QUIRKS MODE */ /* w\idth:175px; */ /* VALID MODE */ w\idth:167px; } /* style the top level hover */ #rgbar #container #specialtext #gameselector .menu ul a:hover { color:#000000; background-color: #c8c8c8; } #rgbar #container #specialtext #gameselector .menu ul ul a:hover { color:#FFF; background:#2a78c6; } #rgbar #container #specialtext #gameselector .menu :hover > a, #rgbar #container #specialtext #gameselector .menu ul ul :hover > a { color:#c8c8c8; background:#222; } /* make the second level visible when hover on first level list OR link */ #rgbar #container #specialtext #gameselector .menu ul li:hover ul, #rgbar #container #specialtext #gameselector .menu ul a:hover ul { visibility:visible; } /* IE 6 to OPERA Switch */ html > body #rgbar #container #specialtext #gameselector .menu ul li:hover ul, html > body #rgbar #container #specialtext #gameselector .menu ul a:hover ul { d\isplay:block; } I'm ready to give up and just find another one online somewhere that will work. Does anyone know how to create the kind of menu in this site? A http://www.fullyillustrated.com/ Also do anyone know of a easy tutorial/free code covering how to do this? Freaking IE. Must die. Really it must. Unfortunately, I have to code for it, and I can't figure out what went wrong he http://wyqued-design.com/dev/skyview/index.html The navigation, and layout, breaks in IE 7. Any ideas? -Emilie I have the following sample html file (attached). I am trying to display the calculated field using javascript and I created a function (I am a newbie) to do so. However, it persistently shows NaN instead of the required number. I have tried my best over a coupla hours racking my brains and the internet as to why it shows as not a number. I will appreciate any help. Thanks, Now this is really stumping me otherwise i wouldnt be here. I have a Javascript that i have that runs in a php site, i have a section where i can save the code to a part in my admin section for loading special images in diffrent locations. So i used java script for rotation on those images. The funny thing is it loads up in a few pages where it calls the php code. but in other pages it doesnt load anything at all. The call function works. in all pages but where the javascript doesnt work the static image i can place works. But i need it to use the javascript code so i can rotate them aswell. For example: Code: <div id="footads"> <div id="fad"> <? echo $foot1 ?> </div> <div id="fad2"> <? echo $foot2 ?> </div> <div id="fad1"></div> </div> the $foot1 and 2 are footer call function which pulls the java script. I have no problem running multi versions of this script as i change the vars etc in java to make them run. How ever like i said its not loading in some pages. but others it will? here is some linked examples. Working - Default advert images set on 10 sec delays Working diff page - Default advert images set on 10 sec delays not Working - Default advert images set on 10 sec delays Its like its not calling the code from the function, But it is because if you view source. Quote: <div id="footads"> <div id="fad"> <script language="JavaScript" src="/adverts/addbanner1.js" type="text/javascript"></script> <div class='addbanner1'><div id='addbanner1'></div></div><div style="clear:both;"></div> </div> <div id="fad2"> <script type= "text/javascript" src="/adverts/addbanner2.js" type="text/javascript"></script> <div class='addbanner3'><div id='addbanner3'></div></div><div style="clear:both;"></div> </div> <div id="fad1"></div> </div> Hi I have the search functionality with the dropdown values. The UI looks like Have 8 dropdown values and one test box. When i enter the name in the test box choose the dropdown value . based on that name it should go to that related page. but it always going to the same page (ozPrjFileQuickFind.jsp ) which is File. This is the code i am using for. Code: buf.append( "<div id=\"sidebar_quicksearch\" style=\"display: "+showHide+";\"> " ); buf.append( "<table width=100% cellspacing=0 cellpadding=0 border=0 align=center>" ); buf.append( "<tr><td colspan=2 class=normalSmall align=left>"+_p.get("search_bykeyword")+"</td></tr>" ); buf.append( "<tr><td colspan=2 class=verySmall align=left>" ); buf.append( " <form name=QF id=QF action=\"ozPrjFileQuickFind.jsp\" method=post onSubmit=\"Javascript:document.QF.action=document.QF.searchDest.options[document.QF.searchDest.selectedIndex].value;\">" ); buf.append( " <select name=searchDest class=textInputSmall>" ); buf.append( " <option value=\"ozPrjFileQuickFind.jsp\" "+(cat.startsWith("FILE")?"selected":"")+">"+File ); buf.append( " <option value=\"ozPrjBugQuickFind.jsp\" "+(cat.startsWith("BUG")?"selected":"")+">"+Bug ); buf.append( " <option value=\"ozCalApptQuickFind.jsp\" "+(cat.startsWith("APPT")?"selected":"")+">"+Appointment ); buf.append( " <option value=\"ozCalTaskQuickFind.jsp\" "+(cat.startsWith("TASK")?"selected":"")+">"+Task ); buf.append( " <option value=\"ozBbsNoteQuickFind.jsp\" "+(cat.startsWith("NOTE")?"selected":"")+">"+Note); buf.append( " <option value=\"ozInvPrdQuickFind.jsp\" "+(cat.startsWith("PRODUCT")?"selected":"")+">"+Product ); buf.append( " <option value=\"ozCmnSearchAsset.jsp\" "+( cat.startsWith("ASSET")?"selected":"" )+">"+Asset); buf.append( " </select><BR>" ); buf.append( " <input class=textInputSmall type=text name=quickFindText value=\"\"></td></tr>" ); buf.append( "<tr><td class=verySmall align=left><input class=\"smallButton\" type=submit name=go value=\""+_p.get("search")+"\">" ); buf.append( "</td><td></form></td></tr>" ); buf.append( "<tr><td colspan=2 height=10><img src=\"graphics/z0.gif\" height=10></td></tr>" ); buf.append( "</table>" ); buf.append( "</div>" ); In the above code File,Bug,Appointment,Task, Note,Product and Asset are the dropdown values. Suppose I enter the test in the test box and choose "Bug" dropdown value it should go to "ozPrjBugQuickFind.jsp" page which is Bug related page. but it always going to the "ozPrjFileQuickFind.jsp" page. Please respond on this one. Thanks in advance... I'm working on a web site: http://84.9.221.75/domains/backingtr...usicindex.html I'm trying to get the Javascript that controls the scrolling text to scroll on both the left and right sides.....right now it only scrolls on the left, due to the use of getElementById() from what i can see.... So I'm trying to make the javascript see all references to the ID in the document, and make the right panel div scroll as well, but I'm not having any luck.... I have a very basic understanding of Javascript, so I need a little help here guys...thanks.. I can't seem to play MP3s with jPlayer, only OGG. Any ideas? My custom code is below: Code: <script type="text/javascript"> //<![CDATA[ var audioPlaylist; var Playlist; jQuery(document).ready(function(){ Playlist = function(instance, playlist, options) { var self = this; this.instance = instance; // String: To associate specific HTML with this playlist this.playlist = playlist; // Array of Objects: The playlist this.options = options; // Object: The jPlayer constructor options for this playlist this.current = 0; this.cssId = { jPlayer: "jquery_jplayer_", interface: "jp_interface_", playlist: "jp_playlist_" }; this.cssSelector = {}; jQuery.each(this.cssId, function(entity, id) { self.cssSelector[entity] = "#" + id + self.instance; }); if(!this.options.cssSelectorAncestor) { this.options.cssSelectorAncestor = this.cssSelector.interface; } jQuery(this.cssSelector.jPlayer).jPlayer(this.options); jQuery(this.cssSelector.interface + " .jp-previous").click(function() { self.playlistPrev(); jQuery(this).blur(); return false; }); jQuery(this.cssSelector.interface + " .jp-next").click(function() { self.playlistNext(); jQuery(this).blur(); return false; }); }; Playlist.prototype = { displayPlaylist: function() { var self = this; jQuery(this.cssSelector.playlist + " ul").empty(); for (i=0; i < this.playlist.length; i++) { var listItem = (i === this.playlist.length-1) ? "<li class='jp-playlist-last'>" : "<li>"; listItem += "<a href='#' id='" + this.cssId.playlist + this.instance + "_item_" + i +"' tabindex='1'>"+ this.playlist[i].name +"</a>"; // Create links to free media if(this.playlist[i].free) { var first = true; listItem += "<div class='jp-free-media'>("; jQuery.each(this.playlist[i], function(property,value) { if(jQuery.jPlayer.prototype.format[property]) { // Check property is a media format. if(first) { first = false; } else { listItem += " | "; } listItem += "<a id='" + self.cssId.playlist + self.instance + "_item_" + i + "_" + property + "' href='" + value + "' tabindex='1'>" + property + "</a>"; } }); listItem += ")</span>"; } listItem += "</li>"; // Associate playlist items with their media jQuery(this.cssSelector.playlist + " ul").append(listItem); jQuery(this.cssSelector.playlist + "_item_" + i).data("index", i).click(function() { var index = jQuery(this).data("index"); if(self.current !== index) { self.playlistChange(index); } else { jQuery(self.cssSelector.jPlayer).jPlayer("play"); } $(this).blur(); return false; }); // Disable free media links to force access via right click if(this.playlist[i].free) { jQuery.each(this.playlist[i], function(property,value) { if(jQuery.jPlayer.prototype.format[property]) { // Check property is a media format. jQuery(self.cssSelector.playlist + "_item_" + i + "_" + property).data("index", i).click(function() { var index = $(this).data("index"); jQuery(self.cssSelector.playlist + "_item_" + index).click(); jQuery(this).blur(); return false; }); } }); } } }, playlistInit: function(autoplay) { if(autoplay) { this.playlistChange(this.current); } else { this.playlistConfig(this.current); } }, playlistConfig: function(index) { jQuery(this.cssSelector.playlist + "_item_" + this.current).removeClass("jp-playlist-current").parent().removeClass("jp-playlist-current"); jQuery(this.cssSelector.playlist + "_item_" + index).addClass("jp-playlist-current").parent().addClass("jp-playlist-current"); this.current = index; jQuery(this.cssSelector.jPlayer).jPlayer("setMedia", this.playlist[this.current]); }, playlistChange: function(index) { this.playlistConfig(index); jQuery(this.cssSelector.jPlayer).jPlayer("play"); }, playlistNext: function() { var index = (this.current + 1 < this.playlist.length) ? this.current + 1 : 0; this.playlistChange(index); }, playlistPrev: function() { var index = (this.current - 1 >= 0) ? this.current - 1 : this.playlist.length - 1; this.playlistChange(index); }, supplied: "mp3", addMedia: function(media){ this.playlist.push(media); this.playlistNext(); } }; }); var last_el=''; jQuery('.track .wrap .play').click(function(){ var cur_img = jQuery(this).css('backgroundImage'); if(cur_img.substring(cur_img.length-10)=='play.png")'){ if(last_el!=''){ last_el.css('background-image','url("img/play.png")'); } var el = jQuery(this); last_el = el; parent.frames[1].addSong(el.attr("title"),el.attr("mp3"),el.attr("ogg")); el.css('background-image','url("img/pause.png")'); }else{ parent.frames[1].pauseSong(); } }); jQuery('.jp-interface .jp-pause').click(function(){ last_el.css('background-image','url("img/play.png")'); }); jQuery('body a').click(function(){ var el = jQuery(this); var href = el.attr('href'); if(href.substring(0,1)=='/'){ parent.location.href = parent.location.href + href.substring(1,href.length); } }); //]]> </script> Please explain! This is so frustrating :/ There is: <script language="text/javascript"> function spYL() { alert("FFFFFFFFFFFFFFF"); } inside head area and there is: <input name="Button" type="button" value="Επιλογή υλικών" onClick="spYL();"> But it doesn't work! I have multiple input fields that use the onkeypress event to fire off the a submit button to run a makeRequest. On Firefox everything works great but in IE 7 and 8 no matter which input field your curser is in it always does the very first input field/makeRequest as well. Code: <fieldset> <legend>Test if mail server accepts email for a user.</legend> <div class="reportlabel">Enter the email address you wish to test.</div> <input name="mailbox_name" class="reportinput" type="text" value="" size="34" id="mailbox_name" onkeypress="if (event.keyCode == 13) document.getElementById('mailbox_submit').click();" /> <input name="Submit" type="submit" class="submit" name="mailbox_submit" id="mailbox_submit" value="" onClick="pingRequest('tools/mail_test.php?mb=' + document.getElementById('mailbox_name').value + '&test=mailbox', 'mb_div');" /> <div id="mb_div"></div> </fieldset> <div style="height:25px;"> </div> <fieldset> <legend>Test if domain has a mail server and it accepts mail.</legend> <div class="reportlabel">Enter the domain you wish to test.</div> <input name="accept_email" class="reportinput" type="text" value="" size="34" id="accept_email" onkeypress="if (event.keyCode == 13) document.getElementById('accept_submit').click();" /> <input name="Submit" type="submit" class="submit" name="accept_submit" id="accept_submit" value="" onClick="blRequest('tools/mail_test.php?domain=' + document.getElementById('accept_email').value + '&test=accept', 'email_div');" /> <div id="email_div"></div> </fieldset> Ive tried onkeydown, onkeyup everything gives the same result. Any help on the this would be greatly appreciated. Thanks Does anyone know why Lightbox images would be displaying in reverse order? The numbers are correct but it pops up on the last one and I have to hit previous to get to the front.
Hello guys I am doing a simple calculation. Here is the code Code: dose=1 A = document.rhogam.bleed.value B = document.rhogam.volume.value dose= (A*B)/3 dose=Math.round(dose*10)/10; this works fine and gives me an answer rounded to the tenths spot. the next step i need to do is round up by one if the tenths spot is less than 4 or round up by 2 if the tenths is 5 plus example 3.3=4 3.6=5 The code issue I am having is how do I read the tenths place in my result so that I can act on it? Thanks Jeremy Hi Experimenting. Trying to add a simple onclick event via onload, but I can't get it right? This works: Code: function checkStatus(box){ if(box.checked != box.defaultChecked){ alert("box status has changed"); } } HTML <input type="checkbox" name="mycheckbox" id="mycheckbox" value="&cost=free" onclick="checkStatus(this)" /> This does not: Code: <input type="checkbox" name="mycheckbox" id="mycheckbox" value="&cost=free" /> window.onload = function (){ var mybox = document.getElementById('mycheckbox'); mybox.onclick = checkStatus ; //how to get this to work?? //none of the following work //mybox.onclick = checkStatus; //this calls the function but I don't have a box ref //mybox.onclick = checkStatus(); //mybox.onclick = checkStatus(this); //mybox.onclick = checkStatus(mybox); } LT I'm developing a FlashCard App for Mozilla based browsers, and i seem to be having a strange problem. When i goto write the data file, it for some reason is not writing the CR and LF. In the datafile i'm just getting one long string of data. Hopefully i can get this app functional by today. I want to get back to studying chinese while i'm bussing to work Code: <html> <head> <script language="javascript"> // Set Global Variables var Know = 0; var DontKnow = 0; var CurrentCard = 0; var ChineseCard = new Array(); var PinYinCard = new Array(); var EnglishCard = new Array(); var NumberOfCards = 0; var DataFile = "C:" + String.fromCharCode(92) + "FlashCard.txt"; var Delimeter = ","; var EndOfRecordTerminationCharacter = "."; function init() { document.getElementById("FlashCardPlayer").style.visibility = "hidden"; document.getElementById("FlashCardEditor").style.visibility = "hidden"; document.getElementById("MainMenu").style.visibility = "visible"; } function ShowPlayer() { document.getElementById("FlashCardPlayer").style.visibility = "visible"; document.getElementById("MainMenu").style.visibility = "hidden"; document.getElementById("FlashCardEditor").style.visibility = "hidden"; LoadFlashCard(); } function ShowEditor() { document.getElementById("FlashCardEditor").style.visibility = "visible"; document.getElementById("FlashCardPlayer").style.visibility = "hidden"; document.getElementById("MainMenu").style.visibility = "hidden"; } function ShowMain() { document.getElementById("MainMenu").style.visibility = "visible"; document.getElementById("FlashCardPlayer").style.visibility = "hidden"; document.getElementById("FlashCardEditor").style.visibility = "hidden"; } function btnClickShowPinYin() { document.getElementById("PinYin").value = PinYinCard[CurrentCard]; } function btnClickShowEnglish() { document.getElementById("English").value = EnglishCard[CurrentCard]; } function ClearEditor() { // Clear all the text boxes in the editor document.getElementById("EditChinese").value = ""; document.getElementById("EditPinYin").value = ""; document.getElementById("EditEnglish").value = ""; } function WriteData() { // Conicate the Record data var WriteData = document.getElementById("EditChinese").value + Delimeter + document.getElementById("EditPinYin").value + Delimeter + document.getElementById("EditEnglish").value + EndOfRecordTerminationCharacter + "\n"; // Load the data file's current contents var OldData = LoadFromDisk(DataFile); var AppendData = OldData + WriteData + "\n"; // Write the data to the file SaveToDisk(DataFile, AppendData); // Clear the TextBoxes to prepare for the next entry ClearEditor(); } var Records = new Array(); var Elements = new Array(); function LoadFlashCard() { // Load the FlashCard Information from the DataFile into the Arrays LoadData = LoadFromDisk(DataFile); // Loop through the String and record the locations of the delimeters // Split the data string into records Records = LoadData.split("."); // Split the Records into Elements for (var x = 0; x <= Records.length; x++) { Elements = Records[x].split(","); } // Load the Elements in to the ChineseText, PinYin, and English Arrays NumberOfCards = 3 / Elements.length; // Load the Chinese Characters "12, 123, 1234, 12345, 123456, 1234567 var Ptr = 0; for (var x = 0; x < Records.length; x = x + 3) { ChineseCard[Ptr] = Elements[x]; Ptr++; } Ptr = 0; // Load the PinYin for (var x = 1; x < Records.length; x = x + 3) { PinYinCard[Ptr] = Elements[x]; Ptr++; } Ptr = 0; // Load the English for (var x = 2; x < Records.length; x = x + 3) { EnglishCard[Ptr] = Elements[x]; Ptr++; } } function btnClickKnow() { Know = Know + 1; if(CurrentCard == NumberOfCards) { // Display the score alert("You scored " + Know + " out of " + NumberOfCards); CurrentCard = 0; Know = 0; DontKnow = 0; // clear all textboxes and put index(0) chinese character into the chinese character textbox } CurrentCard = CurrentCard + 1; document.getElementById("PinYin").value = ""; document.getElementById("English").value = ""; document.getElementById("ChineseCharacter").value = ChineseCard[CurrentCard]; } function btnClickDontKnow() { DontKnow = DontKnow + 1 if(CurrentCard == NumberOfCards) { // Display the score alert("You scored " + Know + " out of " + NumberOfCards); CurrentCard = 0; Know = 0; DontKnow = 0; // clear all textboxes and put index(0) chinese character into the chinese character textbox } CurrentCard = CurrentCard + 1; document.getElementById("PinYin").value = ""; document.getElementById("English").value = ""; document.getElementById("ChineseCharacter").value = ChineseCard[CurrentCard]; } function SaveToDisk(FileName, Content) { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); } catch (e) { alert("Permission to save file was denied."); } var file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); file.initWithPath( FileName ); if ( file.exists() == false ) { file.create( Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 420 ); } var outputStream = Components.classes["@mozilla.org/network/file-output-stream;1"] .createInstance( Components.interfaces.nsIFileOutputStream ); outputStream.init( file, 0x04 | 0x08 | 0x20, 420, 0 ); var output = Content; var result = outputStream.write( output, output.length ); outputStream.close(); } function LoadFromDisk(filePath) { if(window.Components) try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); file.initWithPath(filePath); if (!file.exists()) return(null); var inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream); inputStream.init(file, 0x01, 00004, null); var sInputStream = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream); sInputStream.init(inputStream); return(sInputStream.read(sInputStream.available())); } catch(e) { //alert("Exception while attempting to load\n\n" + e); return(false); } return(null); } </script> </head> <body onload="init()"> <!-- ***************************************** Flash Card Player ***************************************** --> <div id="FlashCardPlayer" style="position: absolute; left: 0px; top: 0px;" > <input id="ChineseCharacter" type="textbox" style="position: absolute; left: 75px; top: 5px; width: 100px; height: 100px; font-size: 35px;"> <input id="PinYin" type="textbox" style="position: absolute; left: 5px; top: 110px; width: 225px;" > <input id="English" type="textbox" style="position: absolute; left: 5px; top: 135px; width: 225px;"> <input type="button" value="Know" style="position: absolute; left: 5px; top: 170px; width: 100px; height: 30px;" onclick="btnClickKnow();"> <input type="button" value="Dont Know" style="position: absolute; left: 125px; top: 170px; width: 100px; height: 30px;" onclick="btnClickDontKnow();"> <input type="button" value="PinYin" style="position: absolute; left: 5px; top: 210px; width: 100px; height: 30px;" onclick="btnClickShowPinYin();"> <input type="button" value="English" style="position: absolute; left: 125px; top: 210px; width: 100px; height: 30px;" onclick="btnClickShowEnglish();"> <a href="" style="position: absolute; left:10px; top: 245px;" onclick="ShowMain();">Home</a> <TextArea id="DataArea" style="visibility: hidden;"></TextArea> </div> <!-- ****************************************** Flashcard Editor ****************************************** --> <div id="FlashCardEditor" style="position: absolute; left: 0px; top: 0px;"> <input id="EditChinese" style="position: absolute; left: 75px; top: 5px; width: 100px; height: 100px; font-size: 35px;" type="textbox"> <input id="EditPinYin" style="position:absolute; left: 5px; top: 110px; width: 225px;" type="textbox"> <input id="EditEnglish" style="position:absolute; left: 5px; top: 135px; width: 225px;" type="textbox"> <input id="EditClearTextButton" value="Clear" style="position:absolute; left: 5px; top: 180px; width: 100px; height: 30px;" onclick="ClearEditor();" type="button"> <input name="EditOKButton" value="OK" style="position: absolute; left: 125px; top: 180px; width: 100px; height: 30px;" onclick="WriteData();" type="button"> <a href="" style="position: absolute; left:10px; top: 225px;" onclick="javascript:Alert("*sigh* i'm getting to it!");">New</a> <a href="" style="position: absolute; left:10px; top: 245px;" onclick="btnClickShowMain();">Home</a> </div> <!-- ****************************************** Define the Layer for the Main menu ****************************************** --> <div id="MainMenu" style="position: absolute; left: 0px; top: 0px;"> These are the instructions for the Flashcard App. In the future, there should be a score board and a selection of word lists and other such things. However, it's blank for now until i finish this app :) <input value="Study Flashcards" style="position: absolute; left: 50px; top: 170px; width: 120px; height: 30px;" onclick="javascript:ShowPlayer();" type="button"> <input value="Edit Flashcards" style="position: absolute; left: 50px; top: 210px; width: 120px; height: 30px;" onclick="ShowEditor();" type="button"> </div> </body> </html> Hi guys! I'm trying to make a div layer (id "tehz") fade in using Java. Problem is, it doesn't go through the animation, it just skips to the last stage. If I put an alert to show me the value of "cat" at every step it works just fine. Can anyone please tell me what's the matter? Code: function vis(cat) { if(cat<=90) { // alert(cat) document.getElementById("tehz").style.opacity=cat/100; document.getElementById("tehz").style.filter="alpha(opacity="+cat+")" cat=cat*1+1 setTimeout(vis(cat),1000); } } I can't seem to play MP3s with jPlayer, only OGG. Any ideas? My custom code is below: Code: <script type="text/javascript"> //<![CDATA[ var audioPlaylist; var Playlist; jQuery(document).ready(function(){ Playlist = function(instance, playlist, options) { var self = this; this.instance = instance; // String: To associate specific HTML with this playlist this.playlist = playlist; // Array of Objects: The playlist this.options = options; // Object: The jPlayer constructor options for this playlist this.current = 0; this.cssId = { jPlayer: "jquery_jplayer_", interface: "jp_interface_", playlist: "jp_playlist_" }; this.cssSelector = {}; jQuery.each(this.cssId, function(entity, id) { self.cssSelector[entity] = "#" + id + self.instance; }); if(!this.options.cssSelectorAncestor) { this.options.cssSelectorAncestor = this.cssSelector.interface; } jQuery(this.cssSelector.jPlayer).jPlayer(this.options); jQuery(this.cssSelector.interface + " .jp-previous").click(function() { self.playlistPrev(); jQuery(this).blur(); return false; }); jQuery(this.cssSelector.interface + " .jp-next").click(function() { self.playlistNext(); jQuery(this).blur(); return false; }); }; Playlist.prototype = { displayPlaylist: function() { var self = this; jQuery(this.cssSelector.playlist + " ul").empty(); for (i=0; i < this.playlist.length; i++) { var listItem = (i === this.playlist.length-1) ? "<li class='jp-playlist-last'>" : "<li>"; listItem += "<a href='#' id='" + this.cssId.playlist + this.instance + "_item_" + i +"' tabindex='1'>"+ this.playlist[i].name +"</a>"; // Create links to free media if(this.playlist[i].free) { var first = true; listItem += "<div class='jp-free-media'>("; jQuery.each(this.playlist[i], function(property,value) { if(jQuery.jPlayer.prototype.format[property]) { // Check property is a media format. if(first) { first = false; } else { listItem += " | "; } listItem += "<a id='" + self.cssId.playlist + self.instance + "_item_" + i + "_" + property + "' href='" + value + "' tabindex='1'>" + property + "</a>"; } }); listItem += ")</span>"; } listItem += "</li>"; // Associate playlist items with their media jQuery(this.cssSelector.playlist + " ul").append(listItem); jQuery(this.cssSelector.playlist + "_item_" + i).data("index", i).click(function() { var index = jQuery(this).data("index"); if(self.current !== index) { self.playlistChange(index); } else { jQuery(self.cssSelector.jPlayer).jPlayer("play"); } $(this).blur(); return false; }); // Disable free media links to force access via right click if(this.playlist[i].free) { jQuery.each(this.playlist[i], function(property,value) { if(jQuery.jPlayer.prototype.format[property]) { // Check property is a media format. jQuery(self.cssSelector.playlist + "_item_" + i + "_" + property).data("index", i).click(function() { var index = $(this).data("index"); jQuery(self.cssSelector.playlist + "_item_" + index).click(); jQuery(this).blur(); return false; }); } }); } } }, playlistInit: function(autoplay) { if(autoplay) { this.playlistChange(this.current); } else { this.playlistConfig(this.current); } }, playlistConfig: function(index) { jQuery(this.cssSelector.playlist + "_item_" + this.current).removeClass("jp-playlist-current").parent().removeClass("jp-playlist-current"); jQuery(this.cssSelector.playlist + "_item_" + index).addClass("jp-playlist-current").parent().addClass("jp-playlist-current"); this.current = index; jQuery(this.cssSelector.jPlayer).jPlayer("setMedia", this.playlist[this.current]); }, playlistChange: function(index) { this.playlistConfig(index); jQuery(this.cssSelector.jPlayer).jPlayer("play"); }, playlistNext: function() { var index = (this.current + 1 < this.playlist.length) ? this.current + 1 : 0; this.playlistChange(index); }, playlistPrev: function() { var index = (this.current - 1 >= 0) ? this.current - 1 : this.playlist.length - 1; this.playlistChange(index); }, supplied: "mp3", addMedia: function(media){ this.playlist.push(media); this.playlistNext(); } }; }); var last_el=''; jQuery('.track .wrap .play').click(function(){ var cur_img = jQuery(this).css('backgroundImage'); if(cur_img.substring(cur_img.length-10)=='play.png")'){ if(last_el!=''){ last_el.css('background-image','url("img/play.png")'); } var el = jQuery(this); last_el = el; parent.frames[1].addSong(el.attr("title"),el.attr("mp3"),el.attr("ogg")); el.css('background-image','url("img/pause.png")'); }else{ parent.frames[1].pauseSong(); } }); jQuery('.jp-interface .jp-pause').click(function(){ last_el.css('background-image','url("img/play.png")'); }); jQuery('body a').click(function(){ var el = jQuery(this); var href = el.attr('href'); if(href.substring(0,1)=='/'){ parent.location.href = parent.location.href + href.substring(1,href.length); } }); //]]> </script> I have the Jplayer.swf in multiple folders too to prevent path errors, but that still seems to not help. Anybody? In my latest project I have integrated dojo.There I have have a Dnd functionality in which I have to drag a dndItem into a textarea. For this I have converted the textarea to a dojoDnd Target with the dojoType attribute. Now the problem is the target textarea accepts dnd items only in explorer , opera and chrome.But this doesn't works in mozilla.Since my application runs only in mozilla I cannot proceed any more till I get out of this problem. Can you help me out of this? Code: <html> <script> function doit(){ document.write(document.getElementById('myIMG').getAttribute('src')); } </script> <body onLoad="doit()"> <img src="blabla.jpg" id="myIMG"> My question is, why is it, that after loading the page, the image that should be displayed at the page is not being displayed. The only thing that can be seen is text generated by the document.write function. |