JavaScript - Simplify This For Me Please
hi guys,
can someonr put this into an array for me please--don't know much about js.. much obliged for your help btw...when I call the site from google, the divs are open but when I call the site from my browser address bar...the divs are hidden as should be (only in firefox, otherwise great. Any ideas why that might be) thanks a ton DD Code: jQuery(document).ready(function() { jQuery(".content").hide(); //toggle the componenet with class msg_body jQuery(".headinga").click(function() { jQuery(this).next(".content").slideToggle(500); }); }); jQuery(document).ready(function() { jQuery(".content").hide(); //toggle the componenet with class msg_body jQuery(".headingb").click(function() { jQuery(this).next(".content").slideToggle(500); }); }); jQuery(document).ready(function() { jQuery(".content").hide(); //toggle the componenet with class msg_body jQuery(".headingc").click(function() { jQuery(this).next(".content").slideToggle(500); }); }); Similar TutorialsMy crumby DVR (security dvr not tivo) has a remote access page that will run ONLY on internet explorer because it uses active x. This means I can't run it on any other awesome browser and no phones . I want to re write it a little bit, all I need is the log in so I need to re write this a little bit so it will work on all browsers once that happens i can port it to my phone. the video stream comes unprotected and can be viewed decently through its RTSP I just can't control anything. My thoughts are to make a simple webpage with the video streams coming in via RTSP and when you log in you can send commands and can muk about the settings its just the java uses active x and theres a weird server side script I can't make heads or tails of. Here is my log on page, for a limited time I set it back to defaults... http://67.85.223.199:3001 Username: ADMINISTRATOR Password: 000000 so just view the source you don't even have to be in IE to view the source and look at the amount js files. I don't need any of the languages obviously and I don't need to set schedules or any settings, just need the PTZ (pan tilt zoom) controls to work and I need to be logged into do that, I just cant figure out how to make the log in when i re write it. Feel free to mess around I unhooked all cameras except for one, the only thing I ask is that someone look at the source code and take a look at the js and help me make heads/tails of what I don't need I want to make just a basic log in! ohh if you want to just stream the video through RTSP then the RTSP link in rtsp://67.85.223.199:110/cgi-bin/rtspStream/1 ohh and the DVR is a Bosch 600 series a 650-16A to be precise! Don't care what you do, this thing is useless to me if I can't CONTROL it from my phone like they told me. What's the best way to go about this? -Mike SO, thanks for checking this out. If i have 3 text areas for output and an array that can be of size 0 to however big a user passes in values. How would I display the last 3 values of the array in the text areas? Here's what I was thinking psuedoCode, but I just want to know if there is an easier way. thnx! Code: //handling all the cases (ie if i have less than 3 items) var size = array.length display 0 if(size <= 3) if(size == '3'){ display0 = array[0] display1 = array[1] display2 = array[2] if(size == '2') do the same but copy the 2 elements if(size == '1') do the same else var newSize = (size -1) - 1 //to find where the first of the 3 elements will be display0 = array[newsize] display1 = array[newsize+1] display2 = array]newsize+2] Its seems a bit extraneous doing it this method, so i was just wondering if anyone could think of a better way. Thanks again! Hi guys, Is there a way to simplify/shorten this already small piece of code? Ternary is the only thing I can think of, but it will only complicate the code. I don't believe a switch statement would apply. Code: if (sourceCode.substr(startStatus, 60).indexOf("Open") !== -1){ discStatus[i] = "OPEN"; } else if (sourceCode.substr(startStatus, 60).indexOf("Closed") !== -1){ discStatus[i] = "CLOSED"; } else if (sourceCode.substr(startStatus, 60).indexOf("W-List") !== -1){ discStatus[i] = "WAITLISTED"; } else if (sourceCode.substr(startStatus, 60).indexOf("Cancelled") !== -1){ discStatus[i] = "CANCELLED"; } Basically, there's a small substring that I'm checking for one of the four values (open, closed, w-list, and cancelled). Thanks for your time! can someone see a way to minimize this down to one statement that makes it infinate? if(x == i) || (x*1 == i) || (x*2 == i) || (x*3 == i) || (x*4 == i) || ............. x is a var user input. it is numeric. i is the counter placed above the function. |