JavaScript - Having Trouble Figuring This Js Out
I am working on converting something and this is what I have come up with:
http://www.msnsportsnet.com/content/ravenstest.htm However, the width of that is 845 px and I wanted it to drop down to 650 px and make the arrows have the same effect as they did with the 845 px. First I moved the 845 to 650 in the css file, then changed the 845 to 650 in the JS files, I have been unable to figure this out though. If someone could please help that would be great! This is the JS file that I tried to edit: http://www.baltimoreravens.com/includes/jsbin/ravens.js This is the css file: http://www.msnsportsnet.com/content/ravens.css Similar TutorialsHi I am attempting to use a javascript code that ultimately shows a live video feed. The affiliate site that created the code says when they pull up my website page with the code on it, they can see it. My problem is, I cannot, no matter what browser I use. Firefox 10.5, IE9, and Chrome all are set to enable javascript. I'm using Windows Vista Ultimate. I am also using a premium Wordpress theme. I contacted the theme creator and on the support forum there, he was able to see the code working just fine also so I determined it is indeed a problem local to my own settings but I am stumped. I googled and set my browser settings to make sure javascript is enabled in all of them. I run Kaspersky antivirus; I tried disabling my firewall, no dice. I ran malwarebytes, that didn't help either. EVERYTHING on my pc is up to date, this has really got me stumped. I know I'm missing something; just can't figure out what I also admin a second site using the same WP theme so I tried it there as well, still can't see it. I so appreciate any suggestions. Thank you so much for your time Hi, I am trying to figure out how the get the featured area at http://blueoceanportfolios.com to link to webpages rather than displaying it within the featured box on the left . This area is using JS file to display the videos on content in the featured box when different items on the menu are clicked, here is the working example : http://www.blueoceanportfolios.com/company/ Okay , The problem: Loading a new webpage rather than displaying the content at featured box at http://blueoceanportfolios.com Tried solutions: linking to javascript functions like onclick="window.location="http://someplace.com";" etc but still the content loads up in the featured box , try clicking on 2) it displays http://www.codingforums.com rather than loading new page. Any suggestions I was going through LinkedIn today, when I noticed something that I couldn't figure out, logic-wise. When you search using their search feature at top left, results come up live... no big deal, easy enough, keyup, no biggie. When you click outside the input box, it disappears, which is blur. However, if you click out of the input onto the search results, it remains, and stays up until you click somewhere outside of the input box or the search results. This I have no idea how is done. Is there a way to know what element a user clicks on? Anyone have thoughts/guidance for this? I'm using jQuery as a framework if that helps? Hi guys, I need some help. I'm trying to make a banner in java or jquery. Idea is div 1 div 2 div 3 div 4 >> custom div1 button >> custom div2 button >> custom div3 button >> custom div4 button I've also added an image of something i have in mind... i can do the CSS but i can't figure out a good tutorial. The closest I found on google was this http://cssglobe.com/lab/easyslider1.7/02.html but its with numbers.. Hello, What I need is a simple service area, zip code validation form that redirects to a certain URL when a valid zip code is submitted and a different URL when an invalid zip code is submitted. I found a form script example that works well with only a single zip code. My problem is I can't figure out how to modify it so that multiple zip codes are valid. Here is the head part. 60016 is one of about 50 valid zip codes I need the form to accept as valid - [code] <script> var correctCode = "60016"; function validateCode() { var code = document.getElementById("codeTextBox").value; if (code == correctCode) { window.location.href = "/ggc/test1"; } else { window.location.href = "/ggc/test2"; } } </script> [code] Here is the body part - [code] Please enter your zip code: <input type="text" name="codeTextBox" id="codeTextBox" /> <input type="submit" name="Submit" value="Submit" onclick="validateCode()" /> [code] Hey friends, I'm writing a program but I'm having issues. I need to write a program that asks for 3 different numbers (prompt boxes) and determine which number entered was the highest and the 2nd highest. I know what to do for the input and output but I don't know what to do during the processing.
I have a form that does not validate when in a modal. Here is the page: http://www.varsitytrainers.com/purchase1.html It works well. It does not work when viewed on this page: http://www.varsitytrainers.com/bosto...ltrainers.html - Then click "Apply Now" and then click "Featured Membership" then click "Submit" You will see that the validation does not take place. I have been banging my head against the desk for days now. Please help. OK i really hope someone can help me because this has put a complete halt to what I'm doing right now. i have various images in a 12x12 grid with names such as x1y1, x2y2, ect I need to check what x1y1's image SRC is. I have been trying stuff like this: var xpos = 1 var ypos = 1 var IMAGENAME = "x" + xpos + "y" + ypos blah = ('document.' + IMAGENAME + '.src') if (blah == "something.gif") { do what i want } Just doesn't work, nor has the 80 other things I've tried lol. Can anyone help me out? I am working on converting something and this is what I have come up with: http://www.msnsportsnet.com/content/ravenstest.htm The width of the original file was 845 px, I needed to change it to 235 px though. As I have knocked the size down of everything, I noticed the arrows are now not working correctly. The arrow only goes to the right once and to the left once, I need to it to go to the right and left multiple times. Here is the javascript file that I have been working with: Code: // gameday scroller function scrollGameday(dir) { var cssDir= (dir<0) ? 'right':'left'; var scrollWidth = 235; var scrollSpeed = 235; var scrollWrapLeft = parseInt($("#gameScroller").css("left")); if(okScroll == false) { return; } if(cssDir == "left") { if($("#arrowRight").hasClass("disable")) $("#arrowRight").removeClass('disable'); if(currentPane <= 1) { return; } else { scrollWrapLeft = (scrollWrapLeft + (dir * scrollWidth)); okScroll = false; $("#gameScroller").animate({left: scrollWrapLeft+"px"}, scrollSpeed, function() { okScroll = true; }); currentPane = currentPane-dir; if(currentPane <= 1) { if(!$("#arrowLeft").hasClass("disable")) $("#arrowLeft").addClass('disable'); } } } if(cssDir == "right") { if($("#arrowLeft").hasClass("disable")) $("#arrowLeft").removeClass('disable'); if(currentPane >= paneCount) { if(!$("#arrowRight").hasClass("disable")) $("#arrowRight").addClass('disable'); return; } else { scrollWrapLeft = (scrollWrapLeft + (dir * scrollWidth)); okScroll = false; $("#gameScroller").animate({left: scrollWrapLeft+"px"}, scrollSpeed, function() { okScroll = true; }); currentPane = currentPane-dir; if(currentPane >= paneCount) { if(!$("#arrowRight").hasClass("disable")) $("#arrowRight").addClass('disable'); } } } checkCurrentPane(currentPane); } function checkCurrentPane(currentPane) { alert('check'); if(currentPane == 1) { if(!$("#arrowLeft").hasClass("disable")) $("#arrowLeft").addClass('disable'); } else if(currentPane == paneCount) { if(!$("#arrowRight").hasClass("disable")) $("#arrowRight").addClass('disable'); } } $("#gameScroller").each(function (i) { var scrollWidth = 235; var newLeftPos = (i * scrollWidth)+"px"; $("#gameScroller:eq("+i+")").css("left", newLeftPos); var items = $('.game'); $('#gameScroller').css('width', items.length * items[0].offsetWidth + 'px'); $("#arrowLeft").click(function() { scrollGameday(3); return false; }); $("#arrowRight").click(function() { scrollGameday(-2); return false; }); }); if("#gameScroller") { var okScroll = true; var currentPane = 1; var paneCount = Math.ceil(($(".game").length) / 10); if(paneCount <= 1) { $(".arrow").className = $(".arrow").className + ' disable'; } else if (paneCount > 1) { $("#arrowLeft").addClass('disable'); } preScroll(); } function preScroll() { var games = $('.game'); for(n=0; n<games.length; n++) { if(games[n].className.match('active')) { var currFrame = Math.floor(n/10); scrollGameday(-currFrame); } } } This is the CSS file: http://www.msnsportsnet.com/content/ravens.css Thank you very much and any help is much appreciated. Hey, I'm trying to make some information from a database convert to JS Code: <?php include ("Scripts/connection.php"); $qry1 = "SELECT * FROM news"; $result1 = mysql_query($qry1); ?> <script type="text/javascript"> var pausecontent=new Array() <?php while($news = mysql_fetch_array($result1)) { echo 'pausecontent[0]="<a href=\"news.php#'.$news['id'].'\">'.$news['news'].'</a><br />'.$news['news'].'!";'; } ?></script> however I just see undefined... any ideas? Hi all, I have created the following page http://kylehouston.com/new/index_new.html I have used JQuery to add animated load icon followed by my images fading in, the load works fine and the images appear but the problem is the fade in wont work. I have tried a few methods to try and get them to fade including adding spans round my images but the only thing that seems to work for me is setting all divs to fade in which I dont want to happen. Anyone got any advice? Thanks in advance! Kyle I've got a problem at the bottom where the "ignore case" bit is, I simply need the code to loop whether the user types a uppercase "Y" or a lowercase "y". The error I am getting right now is that it doesn't loop whether i type a lowercase or uppercase "Y". Code: console.log("Calculator program"); console.log(" "); console.log("1. Add numbers"); console.log("2. Subtract numbers"); console.log("3. Multiply numbers"); console.log("4. Divide numbers"); do { var option = prompt("What operate do you want to choose? "); var first = prompt("Enter your first number: "); var second = prompt("Enter your second number: "); if (option == 1) { var total1 = (first+second); console.log("The total is "+total1); } else if (option == 2) { var total2 = (first-second); console.log("The total is "+total2); } else if (option == 3) { var total3 = (first*second); console.log("The total is "+total3); } else if (option == 4) { var total4 = (first/second); console.log("The total is "+total4); } var retry = prompt("Another calculation?"); var yes = "y".ignoreCase; } while (retry == yes); Reply With Quote 01-08-2015, 08:11 PM #2 Philip M View Profile View Forum Posts Supreme Master coder! Join Date Jun 2002 Location London, England Posts 18,371 Thanks 204 Thanked 2,573 Times in 2,551 Posts while ((retry == "y") || (retry == "Y")) Be aware that prompts and alerts are considered to be long obsolete. You should use DOM methods to obtain input from and display messages to your users. If you do use prompts get rid of the ugly 'undefined'. Quizmaster: Which word for a spring or town with thermal or mineral waters used for drinking or bathing takes its name from a town in Belgium which is famed for its supposedly curative waters? Contestant: Volvic All, I have the following code: Code: var http_request = false; function makePOSTRequest(url, parameters) { alert(parameters); http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { // set type accordingly to anticipated content type //http_request.overrideMimeType('text/xml'); http_request.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { alert('Cannot create XMLHTTP instance'); return false; } http_request.onreadystatechange = alertContents; http_request.open('POST', url, true); http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http_request.setRequestHeader("Content-length", parameters.length); http_request.setRequestHeader("Connection", "close"); http_request.send(parameters); } function alertContents() { if (http_request.readyState == 4) { if (http_request.status == 200) { result = http_request.responseText; document.getElementById('myspan').innerHTML = result; } else { alert('There was a problem with the request.'); } } } function getjob(obj) { var poststr = "job_id=" + encodeURI( obj ); makePOSTRequest('getnextjob.php', poststr); } I call the getjob but doing the following: echo "<li><a href=\"#\" onclick=\"javascript:getjob($resultsetjob[job_id]); return false;\">$resultsetjob[name]</a></li>"; It's weird, only sometimes does it pass the variable and other times it doesn't. Is there a better way to do this?? Thanks in advance. http://icant.co.uk/sandbox/countdown.html Hi, I am trying to understand the countdown above but I am having some problems. I am trying to remove some of the fields under preferences, I just want to show "Time in Seconds" and "warning start" and not any of the other fields. When I try to remove something from the script the entire thing just stop working. So my question is simple, how do I hide/remove fields under preferences without breaking the countdown? Hi, the cookies I am trying to read are values from a form that were stored. The problem I am having is that one value form the form, the value is 5000, was stored as a cookie but I cannot read it. When I display it, it returns: [object HTMLInputElement]. The code for storing the value is this: Code: document.cookie = "bankRoll=" + encodeURIComponent(money) + "; expires=" + expireDate.toUTCString(); , where money = 5000. The code for reading the cookies is this: Code: var cookies = decodeURIComponent(document.cookie); var cookieNumber = new Array(10); cookieNumber = cookies.split("; "); for(var i = 0; i < cookieNumber.length; ++i) { var equalPos1 = cookieNumber[i].search("="); if (cookieNumber[i].substring(0, equalPos1) == "firstName") firstName = cookieNumber[i].substring(equalPos1 + 1); if (cookieNumber[i].substring(0, equalPos1) == "lastName") lastName = cookieNumber[i].substring(equalPos1 + 1); if (cookieNumber[i].substring(0, equalPos1) == "pCode") pCode = cookieNumber[i].substring(equalPos1 + 1); if (cookieNumber[i].substring(0, equalPos1) == "bankRoll") bankRoll = cookieNumber[i].substring(equalPos1 + 1); if (cookieNumber[i].substring(0, equalPos1) == "lastVisit") lastVisit = cookieNumber[i].substring(equalPos1 + 1); } The only one that does not display properly is the variable bankroll. All the others return the proper value. I would like to know how to fix my code so that the value 5000 is displayed. Hi i start of with a some csv data and convert this into an array. The resulting array looks like the following [["Apple", "64"], ["Banana", "20"], ["pear", "12"], ["Orange", "16"]] But i need this to be formatted as below without the quotes around the second value. [["Apple", 64], ["Banana", 20], ["pear", 12], ["Orange", 16]] Im not sure how to achieve this. I guess i need to loop through the array and strip out the quotes but im failing to get this working. Help! I am getting an error: "document.getElementById("gender") is null" Any ideas how I can get this to work? Code: <head> <script type="text/javascript"> var selected = document.getElementById("gender").selectedIndex; var lname = document.getElementById("lastname"); var boyarray=new Array(); boyarray[0]="Joseph James"; boyarray[1]="Robert Michael"; boyarray[2]="Brian Shawn"; boyarray[3]="Joseph Duke"; var boymax=(boyarray.length - 1); var boychoose = Math.round(Math.random() * boymax); var girlarray=new Array(); girlarray[0]="Christine Louise"; girlarray[1]="Cheyenne Lynn"; girlarray[2]="Kelly Anne"; girlarray[3]="Julia Marie"; var girlmax=(girlarray.length - 1); var girlchoose = Math.round(Math.random() * girlmax); function randomname() { if (selected = "2") { alert((girlarray[girlchoose]) + lname); } else if (selected="1") { alert((boyarray[boychoose]) + lname); } else { alert("Please select a gender."); } } </script> </head> <body> <form onsubmit="randomname(this);"> Last Name:<input type="text" name="lastname" id="lastname"/> <br/> Gender: <select id="gender"> <option value="0">Please select a gender</option> <option value="1">Boy</option> <option value="2">Girl</option> </select> <br/> <input type="submit" id="submit" name="submit" value="Submit"/> </form> </body> Hello, I am researching an issue in a rather big app which displays pdf files in IE window. The issue is that inside javascript code we call 'window.setTimeout( win.focus() ...)' (for the child window), but it doesn't come into focus every time, seems a bit random when it does and does not come into focus. At present I wrote a much smaller app + javascript to reproduce the issue, but it does not manifest in same way. Specifically this is the confusing part: window.setTimeout( function() {win.focus(); win.moveTo( 200 , 200 ); } , 500 , "JavaScript" ); the 'win' does move, but never comes into focus. Any ideas about why the focus function does not accomplish what I'm trying to do? Here's the code of my simplified app + html + javascript: JAVASCRIPT: Code: var win; function f(s) { website="http://machine/apache/jsfnu/mytest" + s + ".txt"; if (!win) win = window.open( website , "thetest" , "toolbar=yes,resizable=yes"); else { win.url = website; } win.navigate(website); win.focus(); window.setTimeout( function() {win.focus(); win.moveTo( 200 , 200 ); } , 500 , "JavaScript" ); } function emitApplet() { document.write("<APPLET CODE=\"mytest.class\" archive=\"mytest.jar,netscape.jar\" NAME=\"myApplet\" MAYSCRIPT HEIGHT=1000 WIDTH=1000> </APPLET>"); } function window_onUnload() { } JAVA code: Code: import netscape.javascript.*; import java.awt.*; import java.awt.event.*; public class mytest extends java.applet.Applet implements ActionListener { Button nextButton; Button prevButton; int _page=1; public void init() { System.err.println("init started"); setLayout(new FlowLayout()); System.err.println("setLayout done"); nextButton = new Button("Next!"); System.err.println("next button created"); prevButton = new Button("Prev!"); System.err.println("prev button created"); add(prevButton); System.err.println("prev button added"); add(nextButton); System.err.println("next button added"); nextButton.addActionListener(this); System.err.println("next button action"); prevButton.addActionListener(this); System.err.println("prev button created"); } public void actionPerformed(ActionEvent evt) { if (evt.getSource() == nextButton) { doButton(++_page); } else if (evt.getSource() == prevButton) { doButton(--_page); } } public void doButton(int page) { JSObject win = JSObject.getWindow(this); JSObject doc = (JSObject) win.getMember("document"); JSObject loc = (JSObject) doc.getMember("location"); String s = (String) loc.getMember("href"); String []args = new String[1]; args[0] = (new Integer(page)).toString(); win.call("f", args); } public void paint (java.awt.Graphics g) { g.drawString("Hello, World9!",50,25); } } HTML: Code: <script type="text/javascript" src="StartTest.js"> </script> <html> <head> <title>try</title> </head> <body bgcolor="#fdf8ed" text="black" language="Javascript" onload="window_onUnload()"> <center> <script type="text/javascript"> emitApplet(); </script> </center> </body> </html> I am not great at using JavaScript but I am working on it. I really need help with my script. I can't seem to find out why my images won't load correctly. I am trying to get a 2 part radio button selection to show different pictures for every combination of colors you can choose. So if I was to pick black and black a black_black.jpg picture will pop up and black_white.jpg will pop up for a black and white selection. Please if anybody can help I could really use it right now. Thanks! Code: <html> <body> <form name = "myform"> <img id = "myImage" src = "MyDefaultImage.jpg"> <br><br> Barrels: -------- Inserts:<br> Black <input type = "radio" name = "col1" value = "black" onclick = "showImage();"> Black <input type = "radio" name = "col2" value = "black" onclick = "showImage();"><br> White <input type = "radio" name = "col1" value = "white" onclick = "showImage();"> White <input type = "radio" name = "col2" value = "white" onclick = "showImage();"><br> Orange <input type = "radio" name = "col1" value = "orange" onclick = "showImage();"> Orange <input type = "radio" name = "col2" value = "orange" onclick = "showImage();"><br> Red <input type = "radio" name = "col1" value = "red" onclick = "showImage();"> Red <input type = "radio" name = "col2" value = "red" onclick = "showImage();"><br> </form> <br> <br> <script type = "text/javascript"> function showImage() { var A = 0; var B = 0; for (var i=0; i <document.myform.col1.length; i++) { if (document.myform.col1[i].checked) { A = document.myform.col1[i].value; } } for (var u=0; u <document.myform.col2.length; u++) { if (document.myform.col2[u].checked) { B = document.myform.col2[u].value; } } var x = A + "_" + B; if (x>0) { var picture = x + ".jpg"; document.getElementById("myImage").src = picture; } } </script> </body> </html> Can anyone look at the link below, and tell me why the infoWindow displays the same xml marker node for each marker Thanks Lee http://www.hotels.seotra.com/ |