JavaScript - Rolling Bug With Ie8 And Firefox
Hi buddys,
I'm trying to create a rolling area on my webpage, which will rolling forever on the top corner of my webpage to show the up coming event, the following is my code, however it works in IE7 or lower, in IE 8, it only rolling one turn, in firefox, it's not moving at all!!! Can anyone help and see what shall I do with it?? Many thanks, Cat <DIV id=rolllink011 style="OVERFLOW: hidden; WIDTH: 189px; HEIGHT: 100px"> <CENTER> <DIV id=rolllink1011 style="WIDTH: 189px; HEIGHT: 120px"> <table width="100%" border="0" id="table011"> <tr> <td height ="100px" width="98%" id="TdBox011"> <p><strong>Events</strong></p> <p align="left">First Event ............Date</p> <p align="left">Second Event ........Date</p> <p align="left">Third Event ...........Date</p></td> </tr> </table> </DIV> </CENTER> <CENTER> <DIV id=rolllink2011></DIV></CENTER></DIV> <script language="Javascript"> function Marquee011(){ if(rolllink2011.offsetTop-rolllink011.scrollTop<=0) rolllink011.scrollTop-=rolllink1011.offsetHeight; else{ rolllink011.scrollTop++; } } function Start011(){ var rollspeed011=40; var rolllink1=TdBox011.offsetHeight; var temp=rolllink1; while(temp<rolllink011.offsetHeight) { document.getElementById("table011").insertRow(1); document.getElementById("table011").rows[1].insertCell(0).innerHTML=TdBox011.innerHTML; temp+=rolllink1; } rolllink2011.innerHTML=rolllink1011.innerHTML; var MyMar011=setInterval(Marquee011,rollspeed011); rolllink011.onmouseover=function() {clearInterval(MyMar011);} rolllink011.onmouseout=function() {MyMar011=setInterval(Marquee011,rollspeed011);} } setTimeout("Start011();",1000); </script> Similar TutorialsHi people, I've been asked to build a rotative news/banner switcher. Like you would see on news channel on TV at the bottom. I am using setInterval() to call an xajax method every X seconds. Works great. I keep trace of an array index and return the next content everytime it is called. (Not forgeting to roll up the index (or go back to 0 if I reach the end)) So for so good. But I was asked to add mouse events to this. The ability to stop the rolling interval onmouseover and resume onmouseout. Same goes with a pause/play button. So I kill the interval using clearInterval(), its stops. onmouseout resumes the first timer AND Creates a new one so it doubles the rotations. I tried various solutions found on google but none of them works at all. I need help to properly start/stop pause/resume a javascript timer. now to the code. I'm using a little xajax here but my problem is from javascript. init() gets called on body onload() Code: function init(){ $xAjax_objResponse = initXajaxObject(); //time script to refresh the banner //I also declare the timer variable there. $xAjax_objResponse->script("var timerMarquise; xajax_refreshMarquise();"); //Starts the timer $xAjax_objResponse->script(getMarquisePlayScript()); return $xAjax_objResponse; } refreshMarquise() sets the banner content Code: function refreshMarquise(){ $xAjax_objResponse = initXajaxObject(); $oRedaction = unserialize($_SESSION["creation2"]["redact"]["obj"]); //Session object $oIdee = $oRedaction->getNextIdee(); //Gets the next object containing the info to show $innerMarquise = getMarquiseInner($oIdee); //builds the html to show the content $xAjax_objResponse->assign("redaction_marquise", "innerHTML", $innerMarquise); //Actually sets the result to the page //without anything to show, I don't display the banner $displayMarquise = count($oRedaction->getArrIdeesValides()) == 0 ? "none":"block"; $xAjax_objResponse->assign("redaction_marquise_cheat", "style.display", $displayMarquise); $_SESSION["creation2"]["redact"]["obj"] = serialize($oRedaction); //Save objects new state - modified index return $xAjax_objResponse; } getMarquisePlayScript() starts the timer Code: function getMarquisePlayScript(){ $script = getMarquisePauseScript(); //I clear the current timer $script .= "timerMarquise = window.setInterval(\"xajax_refreshMarquise()\", 3000);"; //This should call refreshMarquise every 3 seconds return $script; } getMarquisePauseScript() - should stop and clear the interval Code: function getMarquisePauseScript(){ return "window.clearInterval(timerMarquise);"; } Mouse events - call the pause and play scripts Code: onmouseover='xajax_pauseMarquise();' onmouseout='xajax_playMarquise(); thanks for help Hi i have this code that with Firefox work but with IE no; function showPhoto (trElemnt){ if(isKeySent) return; var photoID = ""; var photoIDCell = trElemnt.cells[1]; alert("photoID 1 ->" + photoIDCell.textContent); with IE " photoIDCell.textContent" is udefined. can some help to undertstand ? thanks in advance Hi Im Using YUI 2.4.1 and the dragdrop text box is not edited upon mouse click in FireFox 3.0 where as it works fine in IE. I iwsh i would get some light on this. the file used is dragsrop-min.js Hello all, I have a property of text box which works well in firefox but not in IE ..I am unable to understand why ..andy help is appreciated ? Code: onfocus="this.style.backgroundColor='#F1CC8E';" Hi, I'm new to JS and been thrown in at the deepend as our developer has just left! You are dealing with a total newbie! I have the following script that is not working in FF but is fine in Chrome and IE can anyone tell me what is wrong with it please?! Code: function showTotalCost(val) { if(val=='yes') { if(document.getElementById('secondaryeventtype').value == 'adventure') { document.getElementById('totalcost').innerText = Number(parseFloat(document.getElementById('cost').value) + 100).toFixed(2) + ' (including insurance)'; } else { document.getElementById('totalcost').innerText = Number(parseFloat(document.getElementById('cost').value) + 27).toFixed(2) + ' (including insurance)'; } } else { document.getElementById('totalcost').innerText = document.getElementById('cost').value; } } Code: function calculateGroupMembers() { var iMultiplier; if(document.getElementById('txtGroup1Firstname').value != '' || document.getElementById('txtGroup1Surname').value != '' || document.getElementById('txtGroup1Email').value != '') { iMultiplier=2; } if(document.getElementById('txtGroup2Firstname').value != '' || document.getElementById('txtGroup2Surname').value != '' || document.getElementById('txtGroup2Email').value != '') { iMultiplier=3; } if(document.getElementById('txtGroup3Firstname').value != '' || document.getElementById('txtGroup3Surname').value != '' || document.getElementById('txtGroup3Email').value != '') { iMultiplier=4; } if(document.getElementById('txtGroup4Firstname').value != '' || document.getElementById('txtGroup4Surname').value != '' || document.getElementById('txtGroup4Email').value != '') { iMultiplier=5; } if(document.getElementById('txtGroup5Firstname').value != '' || document.getElementById('txtGroup5Surname').value != '' || document.getElementById('txtGroup5Email').value != '') { iMultiplier=6; } document.getElementById('totalcost').innerText = Number(parseFloat(document.getElementById('cost').value) * iMultiplier).toFixed(2) + ' (inc group members)'; } It is fired from an onblur event in the div below once the chkbox is ticked, the link to the page is https://www.doitforcharity.com/book-...eid=1990&cid=0 but you may need to progress through https://www.doitforcharity.com/book-....aspx?eid=1990 first: Code: <div id="pnlGroupBooking"> <label class="boldfieldlabel" for="chkGroupBooking">Do you wish to book for others too? </label> <input id="chkGroupBooking" type="checkbox" language="javascript" onclick="__doPostBack('chkGroupBooking','')" checked="checked" name="chkGroupBooking"> (you may book up to 5 additional people) <div id="pnlGroupBookingNames" style="border: 1px solid LightGrey; width: 500px;" styles="padding:10px;"> <strong>Group Member Names</strong> <br> <p> </p> <p> </p> <p style="vertical-align: top;"> <strong>1) </strong> <input id="txtGroup1Firstname" class="formfieldsmall" type="text" onblur="calculateGroupMembers();" name="txtGroup1Firstname"> <input id="txtGroup1Surname" class="formfieldsmall" type="text" onblur="calculateGroupMembers();" name="txtGroup1Surname"> <input id="txtGroup1Email" class="formfield" type="text" onblur="calculateGroupMembers();" name="txtGroup1Email"> <br> <strong>2) </strong> <input id="txtGroup2Firstname" class="formfieldsmall" type="text" onblur="calculateGroupMembers();" name="txtGroup2Firstname"> <input id="txtGroup2Surname" class="formfieldsmall" type="text" onblur="calculateGroupMembers();" name="txtGroup2Surname"> <input id="txtGroup2Email" class="formfield" type="text" onblur="calculateGroupMembers();" name="txtGroup2Email"> <br> <strong>3) </strong> <input id="txtGroup3Firstname" class="formfieldsmall" type="text" onblur="calculateGroupMembers();" name="txtGroup3Firstname"> <input id="txtGroup3Surname" class="formfieldsmall" type="text" onblur="calculateGroupMembers();" name="txtGroup3Surname"> <input id="txtGroup3Email" class="formfield" type="text" onblur="calculateGroupMembers();" name="txtGroup3Email"> <br> <strong>4) </strong> <input id="txtGroup4Firstname" class="formfieldsmall" type="text" onblur="calculateGroupMembers();" name="txtGroup4Firstname"> <input id="txtGroup4Surname" class="formfieldsmall" type="text" onblur="calculateGroupMembers();" name="txtGroup4Surname"> <input id="txtGroup4Email" class="formfield" type="text" onblur="calculateGroupMembers();" name="txtGroup4Email"> <br> <strong>5) </strong> <input id="txtGroup5Firstname" class="formfieldsmall" type="text" onblur="calculateGroupMembers();" name="txtGroup5Firstname"> <input id="txtGroup5Surname" class="formfieldsmall" type="text" onblur="calculateGroupMembers();" name="txtGroup5Surname"> <input id="txtGroup5Email" class="formfield" type="text" onblur="calculateGroupMembers();" name="txtGroup5Email"> </p> </div> </div> Thanks! Hi All I have a content slider, but it only seems to work in FF and not any of the other browsers. I am using Wordpress but its not a plugin This is what I have: page.php Code: <?php if (is_front_page()) { include ("homepage-slider.php"); } ?> homepage-slider.php Code: <!-- Inner content DIVs should always carry "contentdiv" CSS class --> <!-- Pagination DIV should always carry "paginate-SLIDERID" CSS class --> <div id="slider1" class="sliderwrapper"> <div class="contentdiv"> <div class="home-div1"> <div class="home-div-logo"></div> </div> </div> <div class="contentdiv"> <div class="home-div2"> <span></span> </div> </div> <div class="contentdiv"> <div class="home-div3"> <span></span> </div> </div> </div> <div id="paginate-slider1" class="pagination" style="display:none;"> </div> <script type="text/javascript"> featuredcontentslider.init({ id: "slider1", //id of main slider DIV contentsource: ["inline", ""], //Valid values: ["inline", ""] or ["ajax", "path_to_file"] toc: "#increment", //Valid values: "#increment", "markup", ["label1", "label2", etc] nextprev: ["Previous", "Next"], //labels for "prev" and "next" links. Set to "" to hide. revealtype: "click", //Behavior of pagination links to reveal the slides: "click" or "mouseover" enablefade: [true, 0.2], //[true/false, fadedegree] autorotate: [true, 4000], //[true/false, pausetime] onChange: function(previndex, curindex){ //event handler fired whenever script changes slide //previndex holds index of last slide viewed b4 current (1=1st slide, 2nd=2nd etc) //curindex holds index of currently shown slide (1=1st slide, 2nd=2nd etc) } }) </script> There are 2 other external files : contentslider.js contentslider.css Click Here to see site. If someone could help I would really appreciate it, been bugging me big time. Cheers, Jay so im using firfoxes firebug and its giving me this java script error missing ; before statement document.getElementById("aia").innerHTML = "<p onclick="" >Sword</p>"; i tried just puting this ; behind the beginning but i just cant figure it out. Why will scripts run in IE and not in firefox. I cant find any simple Javascript code that will create a username/password login that will work in both browsers.
Hi all I use the following to verify that a user has entered a number between 0 and 99 in a form: Code: function validate_number(number) { //Checks uploaded files for invalid characters and extensions if (/^([0-9]|[0-9][0-9])$/gi.test(number)) { // anything but 0-99 is disallowed return true; } return false; } It seems to work fine in all browser / machine combos except Firefox on a Mac, when entering 0 returns false (I don't know if entering other numbers also returns false.) Can anybody suggest why? <!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>JS: childNodes</title> <script type="text/javascript"> window.onload = function(){ var li = document.getElementsByTagName("ul")[0].childNodes; var i; var list; for (i=0; i<li.length; i++) { list = li[i]; if(list.nodeType == 1){ list.style.color = "red"; } } } </script> </head> <body> <ul> <li>List 1</li> <li>List 2</li> <li>List 3</li> <li>List 4</li> </ul> </body> </html> Is there any way (except giving ID) that we can let firefox read nodeType as element type? Because I want li[2] (List 3) to be exceptionally green with other being red I know in IE it's simpler, just li[2].style.color = "green"; But Firefox treats everything as a node. Many thanks for any help! i have the following code being called from onsubmit event of form and it is not working in firefox. when debugging it will return at the line of code "row = parcelTable.rows(4);" Any ideas? Code: parcelTable = document.getElementById("parcelTable"); if(x=="parcel" && (ptaxd.value == "" || ppid.value == "" || puid.value == "" )){ rowCount = parcelTable.rows.length; row = parcelTable.rows(4); if(rowCount ==5){ }else{ row = parcelTable.insertRow(4); } cellCount = row.cells.length; errorCell = row.insertCell(cellCount); if(cellCount==0) errorCell = row.insertCell(cellCount+1); errorCell.innerHTML = "Must enter all three fields."; errorCell.setAttribute("id","error"); errorCell.style.color = "red"; isItGarbage = false; parcelError = true; } <form id="parcelForm" name="by_parcel" action="BasicShell" method="get" onsubmit="return validate('parcel');"> Hey people! New to using Javascript but have a problem. Working in Firefox but not in IE, and no errors flash up - it just does not work! Here is my code if anyone has the time to take a peak! What it does in Firefox is has a drop down with two options, both of which call the functions passing over the name of the items to be hidden or displayed. Works fine, but not in IE. Javascript Function: Code: <script type="text/javascript"> function showStuff(id) { document.getElementById(id).style.display = 'block'; } function hideStuff(id) { document.getElementById(id).style.display = 'none'; } </script> Form drop down to call javascript: Code: <select name="golf_package"> <option value='Yes' onClick="showStuff('Golf'); hideStuff('Accommodation')">Yes</option> <option value='No' selected='selected' onClick="showStuff('Accommodation'); hideStuff('Golf')">No</option> </select> Hide and Show date: Code: <span id="Golf" style="display: none; return: false;">HIDE BIT</span><span id="Accommodation" style="display: none; return: false;">HIDE BIT TWO </span> Any help will be much appreciated! Thanks Hi all, This is my first post of many and am new to JS. I'm familiar with Java so I shouldn't be too lost. What I'm about to do is add support for a web app from Firefox to IE that uses OpenLayers. I've searched and found a link to this site from another thread which had a list of supported functions and what not he http://www.quirksmode.org/dom/w3c_core.html From what I've read in the last hour it seems as though I will have to use some browser sniffing (isMozilla, isIE8, etc) and have multiple conditions (if-else's) in my functions to use the proper calls. Does anyone have extra material that contains differences between IE and firefox? Someone mentioned to me that in lists IE doesn't support trailing commas but ff does.. Things like this would be very helpful Thanks, Chris 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> Ok, so I spent all my time making this website http://portfolio.dreamsofatypewriter.com/index.html work on IE. And now it turns out it is Firefox that is trying to ruin me. I am using a simple JQuery by Sam Dunn to slide boxes on the upper left of the landing page. But in Firefox (may be it is just FFX4) it won't run. I can't fathom what can be the problem. Any thoughts? Thanks Sandeep The following extremely simply JavaScript code: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Style-Type" content="text/css"> <meta http-equiv="Content-Script-Type" content="text/javascript"> <script type="text/javascript"> onload=function(){ var n=document.getElementsByTagName('div')[0]; alert(n.innerHTML); } </script> </head> <body> <div>foo</div> </body> </html> alerts the innerHTML content in all the browsers. Except in Firefox 3.6.8, which alerts a blank value. What the f? I know that innerHTML is not a standard DOM method, but it used to be a crossbrowser one since FF 1.5, right? ------- Edit: It does not work even in case of firstChild.nodeValue or firstChild.data. FF 3.6.8 says that the DIV element has no first child, which is amazing. Hi all, I'm faced to a problem : I'm programming a styles generator for the Stylish add-on. What i want is the same thing that when i click on the button "Install with Stylish" : A Window appear to ask user if he wants to install the script with Stylish. I saved the website page on my desktop and opened it. Obviously it did not worked, nothing happens when i click. I also changed the path for javascript file in the html and so on.. There is a XMLhttprequest() function wich opens the url of the style ending by ".css". But i replaced the url by my file path ( by a locally file) and i replaced the statut (200 by 0, because i'm working on a local file). But whatever i do, nothing happens when i click. There is also a function called firecustomevent() who creates the event, but my knowledges are limited at this point. I read document on mozilla website on how to call an event but i can't get it to work. So if anybody knows how to display a windows asking the user if he wants to install the style, i will be grateful. Thanks and sorry for my bad english The url containing the javascript is a simple style url like this one : http://userstyles.org/styles/17120 where you can see the "install with stylish" button. I also attached the concerned javascript in a txt file. Dear all, I'm new with JavaScript, so can please help me with this macro? I need to reload URL (in this case refresh same page) until I don't have word beginning with capitalized A, B or C. I can't find the way to create loop inside EVAL. Can somebody help me please? Thank you! Code: VERSION BUILD=7401110 RECORDER=FX TAB T=1 URL GOTO=http://watchout4snakes.com/CreativityTools/RandomWord/RandomWord.aspx SET !EXTRACT_TEST_POPUP NO TAG POS=1 TYPE=SPAN ATTR=ID:tmpl_main_lblWord EXTRACT=TXT SET !VAR1 EVAL("var re = /^[A || B || C]/gi; var str = \"{{!EXTRACT}}\"; while(str.search(re) == -1) {URL GOTO=http://watchout4snakes.com/CreativityTools/RandomWord/RandomWord.aspx}") PROMPT {{!EXTRACT}} Code: <html> <head> <script> function dt(){ var dt = new Date(); document.getElementById("time").innerHTML=dt; } function changeBgColor1(){ document.getElementById("bgc").style.backgroundColor='#ee0000'; } function changeBgColor2(){ document.getElementById("bgc").style.backgroundColor='#880099'; } function changeBgColor3(){ document.getElementById("bgc").style.backgroundColor='#888888'; } function validate(){ var a = document.getElementById("input1").value; var b = /[abcdef]/; if(b.test(a)){ return true; } else { alert("invalid character"); } } </script> <style> #bgc{ width:300px; height:100px; background-color:#cccccc; font-weight:bold; color:#ff00ff; } #time{ width:300px; height:50px; background-color:#aabb00; } </style> </head> <body onload="dt()"> <p id="time"> </p> <p id="bgc" onmouseover="changeBgColor1()" onmouseout="changeBgColor2()" onclick="changeBgColor3()"> Hi There, pls change bg color </p> <form id="form1" onsubmit="validate()"> <input id="input1" type=text /> <input id="input2" type="submit" value="Submit" /> </form> </body> </html> validate function does not work with IE or Firefox, it always returns true, even if some digits are entered in input box (which should not be validated by regexp). Why does regexp not work ? How to make it work ? Thanks Hello again; I am testing in Firefox( two versions ), Chrome, Opera (two versions), Safari on Mac OSX and am seeing a peculiarity. Code: <div id="dialog" style="position:absolute;top:50px;left:600px;"> <div id="head"><p id="panelTitle">Item Info:</p></div> <p>Drag this panel to move </p> <pre id="target1"><img id="srcImg" src="windows/img/front_window.jpg" alt="test" /></pre> <pre id="target2"> </pre> <div id="closer"><p class="dialog"><a id="dClose" href="javascript:">Close</a></p></div> event listener assigned to a separate anchor tag makes this markup visible and drag-able. The mousemove event listener for dragging is assigned to the parent div, id='dialog' In Firefox and Google's Chrome browser, if I mousedown on the image and try to drag, the system tries to move and copy the image. When I release the mouse, the whole panel sticks to the pointer and moves with the pointer until I click on it. The Question: What event would I do preventDefault, cancelbubble, or return false to get around this? (perhaps for a separate post, how would I prevent the client form copying content?) Safari will do the same accept that it will not stick to the mouse pointer position on mouseup. In Opera, it works fine (accept the earlier verison, v9x leaves a trail of ghost lines where the panel was moved from) I have a pc with I.E. and have not yet tested this specific issue. Thank you for your time and attention JK |