I try to figure out how I can merge two onclick in one: The one is opening a "lightbox" div with a fullsize view. Now I would like to count this click with loading a site in an iframe. I am not that known in javascript, therefore my question: Is it possible?
This would load the iframe:
PHP Code:
onclick=parent.fullsize.location='[URL]';
This is the onclick statement in the lightbox.js:
PHP Code:
anchor.onclick=self._genOpener(num)}var body=d.getElementsByTagName("body")[0];
Separated the both onclick are not working. How I can put them together in one onclick? I tried this, but it is not working:
PHP Code:
anchor.onclick=self._genOpener(num)}var body=d.getElementsByTagName("body")[0] && parent.fullsize.location='[URL]';
I have created a bunch of methods for a shopping cart I am implementing on the website,and at the same time I take information from my database to get the quantity of how much stock I have left.Basically I want to do a bit of error handling, so that if you select 5 things to go into the shopping cart but the amount of items that are in stock is only 3 then an error message will come up saying "Sorry! Don't have that many items in stock!". I have a setCookie method which I created, and it is triggered by an onclick event.
I guess what I am trying to say is... Is it possible to run conditional statements on events such as "onclick" or "onload"? As it currently stands, I am going to have to do the error handling within my external js file and that really seems sloppy to me since I really want that external file to stick to cookie creation. I would really prefer to do my conditionals within my view/html file =/
How do I "merge" the two functions below - checkFromDate() and checkToDate() - so that I only have one function. I want to do the same validation in both text fields, but only have one function that does all the validation.
<html> <head> <script language="JavaScript"> function checkFromDate() { var ToFrom = document.form.txtFromDate.value // Do some other validation... }
function checkToDate() { var ToDate = document.form.txtToDate.value // Do same validation as above... } </script> </head> <body> Start Date : <input type="text" name="txtFromDate" onBlur="checkFromDate()"> yyyy/mm/dd <br> End Date : <input type="text" name="txtToDate" onBlur="checkToDate()"> yyyy/mm/dd </body> </html>
My task was to merge the two arrays into a third array. Done, no problem, merged then sorted a new array. I understand there is a way to merge the two without using "merge" then "sort" functions. My reference material doesn't go into it, and I can't find an example of how this would work. I think there would be a way to do it using a for loop and then "push", but I could be way off.
Can anyone tell me how they could see merging two without using the merge then sort? And what would be the advantage to doing it this alternate way as opposed to using merge? Is there a case where it would be preferable? I'm so new at this that I can't fathom doing anything other than merge.
I have an ezine with two different editions, a European and North American. I've decided to merge the two forms into one to simplify the sign-up procedure. However, I can't get the thing working
Here is the code for the two seperate forms, which was created automatically by the excellent Max-eMail. I've tried to merge them with a radio button like:
Code: <input type=radio name="lists[15]" value="1LitNorthAmerica" CHECKED> North American Edition <input type=radio name="lists[14]" value="1LitEurope">European Edition but the values in [] are different for the countries, sex, etc. (For some reason the "[14]" and "[15]" stop the radio-button working - can't select between the two)
Could anybody be so kind as to help me merge the two forms together?
Here's the code (I haven't listed all the world's countries in the drop-down box to save space):
Currently I'm trying to do the following: { config : { user : "name", mod : true }}
That is JSON nr 1, now I got the following { config : { mod : false }}
What I need as a result is: { config : { user : "name", mod : false }}
If I do a $.extend(json1, json2) then I will lose my user name. If I do a $.merge(json1, json2) I will keep my username, but my mod will not be overwritten.
I have application A and application B deployed in two different app servers.B is launched in a new browser window when user clicks on a link in A .So application B starts as a popup.the problem I am facing is if I logout in B, automatically A also logouts and vice versa.this may be happening becasue of session merge, when new window is called there any way in java script or jquery to open a new browser window without passing the session information ?
I'm trying to setup a mail merge using a gmail docs script from [url]. So far, it works pretty well, but I want to edit it to include the following:
1) The script should start with "Dear Noah" as opposed to "Dear Noah_Kaplan"
2) I want to add my canned response to the script so that it always appears at the bottom of the e-mail.
3) Lastly, I want the outgoing mail to be saved as individual drafts in my drafts folder in gmail before it's sent out. That way, I can decide if I want to add a sentence or two to personalize each individual email draft.
Code: <SELECT NAME=sections > <OPTION>Merge</OPTION> <OPTION>Nuke</OPTION> <OPTION>Merge & Nuke</OPTION> </SELECT> If one selects Merge, then i want another form displayed with input fileds etc.
Can anyone show a script (i.e. javascript) that does just that or care for a example?
I am sure if I searched long enough I could find the answer, but to save time I would appreciate help with the # statements, such as #include, #csstopmenu, etc which I find in the scripts here and elsewhere. I know that #include is used with shtml to include another html page. What are the others? Is there a definitive list, and if so where can I find it?
This code uses a nested IF statement to put a pack of cards into an array of records. But for some reason the cards arn't going in.. like.. at all? I've put a document.write piece of code at end to display the card in the first slot and [object Object] appears? Code:
I need to test the contents of three fields to validate which contain text, and based on the results, set additional variables. I'm sure this is falling off the log simple, and I got it to work in PHP, but am having problems getting the syntax correct in Javascript.
In a nutshell, if a front AND a rear msg is entered, the price is $115, else the price is $80. I'm sure there's an easier way to code this than what I've done, but I don't know how to correctly perform several && and || in the same comparison.
Here's the PHP...
function notEmpty(){ var FrontMsgTxtTop = document.getElementById('FrontMsgTxtTop').value; var FrontMsgTxtBottom = document.getElementById('FrontMsgTxtBottom').value; var RearMsgTxt = document.getElementById('RearMsgTxt').value;
the self.location.href='#add' goes to a html anchor on the page, and the focus is supposed to set the cursor inside the first textbox when the statement is run.
if i run it as is, it will go to the anchor like its supposed to, but won't put the cursor in the textbox. if i comment out the first statement, it will put the focus on the textbox.
I have a very simple script that generates a prompt window. Instead of using a default text, I have left the text field empty. However, I would like a default message to display in the pop up window if the user does not enter a value in the prompt box before clicking okay. I tried adding a conditional statement but the default text does not write in the pop up window.
Here is the code: Code: function promptBox(){ var message = prompt("Who is your favorite Hollywood Star?", ""); newWindow = window.open('','','width=800,height=600'); newWindow.document.write(message); newWindow.focus(); if ((prompt) == null); document.write("No Value Entered"); }
The jQuery isn't working when calling elements placed in conditional statements. My sample code is shown below. This code works beautiful if the if/else conditions aren't there. What is the problem? Is there something wrong with my code? Is there a workaround? I absolutely need to use a conditional statement in my production code.
I have a series of videos which must be loaded dynamically on their pages which then get loaded into an iframe. I need to be able to load these videos using variables for the width and height. It's imperative that I use variables as the sizes of the movies will be determined by the user's resolution.
Here's the code I'm currently using <script type="text/javascript"> var dimW = screen.width; var dimH = screen.height; var w1 = dimW.toString(); var h1 = dimH.toString();
I'm developing in xhtml so naturally, IE doesn't recognize the document.write statements and the page comes up blank in IE. It works flawlessly in FireFox (as expected). So, I need to replace the document.write statements with something else while still being able to pass variables for the movie objects height & width.
I've tried this code: <script type="text/javascript"> //alert("The beginning"); var dimW = window.innerWidth; var dimH = window.innerHeight; var w1 = dimW.toString(); var h1 = dimH.toString(); ..... document.getElementById('mediaPlayer').appendChild(theNewMovie); </script>. I then have a <td> with the id of "mediaPlayer" but nothing is showing up. Most likely because I'm still fairly new to javascript and am probably forgetting or overlooking something.
I am trying to write a multiple-choice quiz for my chemistry class where ten questions are selected randomly from a block of about 100; then I want the students to click a button and grade their quiz. I have stored the questions in an array named Q and each radio button has a name property corresponding to the array entry (the buttons in Q[1] have the name Q1, etc.). I generate the exam in the body of the page between form tags using a document.write statement and all of the questions and buttons appear properly. I cannot, however, figure out how to get the value of the button that has been checked for the randomly selected questions.
As the questions are selected, I record the question number as a variable; for example �Qnumber1 = Q(random_num)�. The variable does, in fact, have the proper value (for example Q1) but when I try to read the value of the radio buttons in the Q1 set using:
I have this calculator function I made to do some simple math and output the solution in a field on a form. I had it working great until I introduced a radio button. There are no errors and the total is still outputted but the number is off and if I change the radio to the other option it doesn't change the total. Here is my code,
function calculateBudget() { var i; var list = 0; var listcost = document.getElementsByName('form[listcost]');
We have to create a number guessing game with a random number between 1 and 50. With a loop that runs exactly 10 times or until you get the number and gives hints that say guess higher or lower. I don't know what I am doing wrong this wont work at all. I am generally lost? lab14a_KENTDL.html (3.48K) Number of downloads: 52
This is what i'm working with now but can only get one function to validate. This is the script I have so far. With credit going to pmw57 Need to be able to validate more than just one function.
<script language="javascript" type="text/javascript"> var form = document.getElementById('healthwiseorder'); form.onsubmit = validateForm; function validateForm() {