Passing Data From Prompt To Function Assistance?

Feb 7, 2009

I'm trying to pass data I gathered from a prompt into a later function.

1. Should prompts for information be in their own JS file separate from the HTML page? Or is it better form to have the prompts (for info) in the HTML page itself?

2. I have tried placing the prompts to gather info in several places, each time my script seems to stop after the data is gathered and does not perform the calculations which are contained within a function. The input data is gathered from a prompt, do I still need to "return valuea" and "return valueb" in order to use the input data in the calculation function? Initially I did not feel I did, as I am not performing a calculation initially, just receiving input.

View 2 Replies


ADVERTISEMENT

Function Validate Assistance

Dec 30, 2005

My validate() function is not working quite right since it should validate for at least on checkbox checked and even if opne is checked it will simply display the error message instead of validating. What might be wrong here?

Here's the function (note, all the checkboxes have the id='chk')

function validate(){
var countChecks = 0;
if (document.forms.getElementById == "chk")
{
for (var j in document.forms.getElementById)
if (j.checked)
countChecks++;
}
if (!countChecks)
{
alert('Select some checkboxes!')
return false;
}}

View 9 Replies View Related

Data Passing From One Function To Another.....

May 8, 2006

I have two functions that are stacked in so much that the second function calls the first.

function1() {

[...]
}
return value;
};

function2() {

[...]
function1()

}
var = function1 returned value

function 1 is function correctly as i have got it to display the data to the screen durrning testing it. however, i have not yet come across a way in which i can get the returned vale into function 2 ...

View 4 Replies View Related

Passing Data To Another Function Inside A Function

Feb 3, 2010

In one variable i have some data ex: var data = document.getElementById("imageId").value; I want to pass this data to another function inside another function ex: var button1 = '<img src="images/Remove-button.gif" width="70" height="15" onclick="removeVerifyImageRow(this),saveLibData('+data+')"/>';

while running the application i am getting an error incase if the data is string ex:if data is 'image1' i am getting an error, but with number there is no problem ex: if data is '1122'.

View 7 Replies View Related

Passing Data To Another Function Inside A Function?

Feb 3, 2010

In one variable i have some data ex: var data = document.getElementById("imageId").value; I want to pass this data to another function inside another function ex:

var button1 = '<img src="images/Remove-button.gif" width="70" height="15" onclick="removeVerifyImageRow(this),saveLibData('+data+')"/>';

while running the application i am getting an error incase if the data is string ex:if data is 'image1' i am getting an error, but with number there is no problem ex: if data is '1122'.

View 5 Replies View Related

Prompt Back Data From Within?

Feb 18, 2011

I have some jQuery

Code:

$(document).ready(function(){
$("#qty$_GET").change(function(){
var firm = $('#firm$_GET').attr('value');[code]....

if there's a way to prompt me with the value of data just so that I can validate the link that's going to go through with this?

View 7 Replies View Related

Js Array Prompt Input Data?

Nov 15, 2011

I am playing about with javascript arrays.Have recently just sat today looking through w3c and going through pages in a w3c book i bought on javascript and ajex.if im wanting to display stuff to use a drop down box but i need to learn to use arrays as the course im studying in college is on javascript and i feel this would be beneficial for me personally to know.i want to know if its possible to as well as select data from the array but also to Input new data from a button that opens a prompt box for users to enter a new array object.

Code JavaScript:
<SCRIPT language="JavaScript">
<!--
function p_Names()[code].....

View 5 Replies View Related

Onclick: Prompt Pulling Data Within An Array

Jan 30, 2010

I should warn, i know almost nothing about javascript. i've been trying read sample scripts and examples on how to modify this script; but I just don't know enough. I have a script that pulls data from an array, and copies it directly to the clipboard when a user clicks on it. The problem is this only works in IE, because Firefox doesn't by default allow that to happen. I'm trying to change it so that when it is clicked, instead, it takes what was going to be copied to the clipboard, and puts it in a Prompt box for the user to copy and paste. I had other scripts that do that, but I can't for the life of me figure out how to learn from it!

[Code]...

View 7 Replies View Related

Prompt Dialogue Boxes And Validating Data?

Jan 30, 2011

I have two prompt dialogue boxes that ask the user the enter their name and their employee number.I am experiencing two errors. The first is, if a user enters their name incorrectly, using numbers for example, there is an error message that asks the user to re-enter their name using a string. If the user ignores the error message and enters a number a second time, the program accepts the entry, which it shouldn't.

The second error has to do with the employee number prompt. The prompt asks the user to enter an employee number that is equal to 6 digits, the program however accepts any number, less than or greater than 6 digits, which it shouldn't.I don't want the user to get away with entering anything incorrectly.

<script type="text/javascript">
// prompt the employer the enter the employee name and number
var employName = prompt ("Please enter the employees' name" , " ");[code].....

View 4 Replies View Related

Prompt Input Not Reading To Constuctor Function?

Sep 30, 2011

I have an assignment where one piece of it needs to have the first name, last name, area code, and phone number when prompted by a function, once that info is had, it then needs to use the constructor function that is there to process the data and lastly use the data to output it with a show function. I have it to work with static information, but cant seem to figure what I am missing or how to make the prompt function information to feed to the constructor, I know when using the static variable it uses "new Function" but that seems to be my problem,code below:

<!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>[codee].........

View 3 Replies View Related

Prompt Input Not Reading To Constructor Function?

Sep 30, 2011

I have an assignment where one piece of it needs to have the first name, last name, area code, and phone number when prompted by a function, once that info is had, it then needs to use the constructor function that is there to process the data and lastly use the data to output it with a show function. I have it to work with static information, but cant seem to figure what I am missing or how to make the prompt function information to feed to the constructor, I know when using the static variable it uses "new Function" but that seems to be my problem, I am stuck.

see the code below:

<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "http:www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http:www.w3.org/1999/xhtml">
<head>

[Code]....

View 1 Replies View Related

Call Prompt Within A Function On OnClick Event?

Aug 31, 2011

I have a button that I wish to call a predefined function (Go()) shown below, but, I wish part of the URL that is sent to the function be inputted by the user.

function Go(URL)
{
window.location = URL;
}

Here is the code I have for the button, but I am getting a syntax error. What do I need to do?

<input type="button" value="Duplicate" onclick="Go(CustomerMailingList-duplicate.asp?ID=<%=rs(strPrimaryKeyFieldRecordset)%>&CustNum=prompt('Enter New Cust #', '0')">

View 5 Replies View Related

Creating Array From Prompt - Function Multiply Returns?

May 11, 2011

<script>
// Declared Constants
MORSE_ALPHABET = new Array (
'.-', // A
'-...', // B
'-.-.', // C
'-..', // D
'.', // E
'..-.', // F
'--.', // G
'....', // H
'..', // I
'.---', // J
'-.-', // K
'.-..', // L
'--', // M
'-.', // N
'---', // O
'.--.', // P
'--.-', // Q
'.-.', // R
'...', // S
'-', // T
'..-', // U
'...-', // V
'.--', // W
'-..-', // X
'-.--', // Y
'--..' // Z
);
CHAR_CODE_A = 65;
var CTS = prompt('Enter Morse code','here')
var inMessage = CTS.split(' ');
searchLocation(inMessage,MORSE_ALPHABET)
function searchLocation(targetValue, arrayToSearchIn) {
var searchIndex = 0; // Iterative counter
for(i=0;i < targetValue.length;) {
targetValue = targetValue[i];
// Search until found or end of array
while( searchIndex<arrayToSearchIn.length && i != targetValue.length &&
arrayToSearchIn[searchIndex]!=targetValue) {
i++searchIndex++;
} if(searchIndex<arrayToSearchIn.length) {
return String.fromCharCode(CHAR_CODE_A + searchIndex);
} else {
return -1;
}}}
document.writeln(searchLocation(inMessage,MORSE_ALPHABET));
</script><head></head><body></body>

This is my code and I have figured it to create an array from the prompt and then use the function to return the first array it finds but I cant seem to make it go on to the next index of the array. I know that when you return a value the function closes and I have tried to store my return in a variable but its not working the way I want it to or I'm not writing the correct command or is there away to do multiply returns, I think what I need to do is simply but I have been staring at this screen for a while now and just cant see it.

View 3 Replies View Related

IDS Signature Unescape Assistance?

Nov 22, 2009

I am by no means a JS programmer, but I like to exhaust all avenues when attacking an issue. A signature fired off on a piece of javascript that came across the wire, with an odd "var unescape" inside of it. I am hoping to throw this code out there, to see if anyone has any insight on what this might be.

I am assuming this is double encoded, but I am not certain. Here is the snippet of code the signature fired off from:

var ibdf=unescape("%u0b0b%u0b0"+"b");
var fdofdopf="xcvb9090";

View 2 Replies View Related

IE To Netscape Event Assistance Needed

Jul 23, 2005

Does the world need another DHTML popup calendar? Probably not, but I'm writing one anyway. It's unique in that it allows drag selection of a range of dates. Works great on IE6 but I'm having some trouble with Netscape and events. In particular, the mousedown event doesn't work. The event fires, but I can't seem to get a handle on what html element was clicked.

View 4 Replies View Related

Troubleshooting Auto-Sum Provide To Get Some Assistance?

Jun 16, 2011

[URL]...heckboxes.html as directed and I can't get it to work. What do I need to provide to get some assistance?

View 14 Replies View Related

Assistance Requested To Identify Dumb Error

Oct 9, 2011

What I'm trying to do here should be simple and I suspect that I'm just overlooking something basic but I'm overlooking it. If you can tell me what I'm not seeing here, I'll be most grateful. This is the associated HTML code. Two statements to be rated from 1 to 10 using radio buttons.

<tr>
<td width="25"><strong>A</strong></td>
<td width="210">A statement is here</td>
<td width="21"><input type="radio" name="SI_QA" id="SI_QA_1" value="1" /></td>
(total of 10 lines like this)

[Code]...

View 13 Replies View Related

Passing Data In Strings

Jul 27, 2007

1) To populate a dropdown control that's on a page with data coming
from the database, the developers concatenate all the values separated
by a pipe character and pass the string to the JS function, which
splits the string and adds the values to the dropdown control.

I think this is not a best practice b/c:

A) If the data returned from the database results in a string that's
too long, it could exceed the limit of the JS string type and some
items would be missing from the dropdown.

B) If by any chance, the data from the database contain pipe
character, it would result in extra elements inserted in the dropdown
control.

Is there a better way to pass data to JS w/o relying in strings? How
can these practices be improved?

View 1 Replies View Related

Passing Data Between Javascript And PHP

May 1, 2006

I am working on an application in which monthly calendars of events are to be generated. When the page is initially loaded, the current month's calendar is generated using Javascript; the user can also move forward to the next month or backward. For each month, I need to be able to retrieve server-side data (using PHP/MySQL) to fill each day-cell ("td"+i, below) of the calendar with events for that day which reside in the server-side database, keyed by date. Here is a snippet of the code that generates the days of a given month:

var d = 1;
for (i = 0; i < 42; i++) {
var elem;
var elem = eval(document.getElementById("td"+i)); //the day cell
elem.innerHTML = "";
if (i >= startingPos && i < lastpos){
elem.innerHTML = d
d += 1;
.
.
return;

In short, I need to get data from the database as the days are created (elem.innerHTML = d, above) or get all the data for the chosen month (probably more efficient), and send it back to the Javascript where it can be parsed and loaded to the appropriate cell(s) in the calendar.

View 4 Replies View Related

Passing Data In Form?

Jan 22, 2009

I have a search form with 3 fields. What i'm trying to do is make it to where when a user clicks submit it sends the data from 2 of the fields to 1 hidden field. (don't tell me to change the names and id, I can't) I am looking for any method to make this work. I just can't change the field names.

example:
first two (visible)
keyword = pizza

[code]....

View 2 Replies View Related

Passing Data Into A Form?

Aug 28, 2010

I am using a variation of this script so that on the homepage of my site, a person can enter their phone number and the data from that form is tranfered onto a form on a second page for the rest of their other data as well as autofilling in their phone number data they entered on the first page.

The output for the code is:

Code:
<SCRIPT LANGUAGE="JavaScript">
areacode = unescape(params["areacode"]);
document.write("areacode = " + areacode + "<br>");
</script>

[Code].....

View 10 Replies View Related

Passing Data To New Page ?

Nov 2, 2011

Problem I am having regarding passing data to new page ?

View 2 Replies View Related

Ajax :: Passing Data From Js To Php

Apr 29, 2010

how to pass data from ajax to a php page in resonable way(meaning that i don't need to code a single string in some strange way then to decode it.) I have some inputs, radio ecc with names and when i pass them to php with ajax/js i would like to know how that data belongs to, without encoding and decoding if that is possible.

View 3 Replies View Related

How EBay Displays Image Previews -- Assistance In Re-creating

Jul 20, 2005

EBay has implemented a different way to upload auction pictures ---
after browsing for the picture and selecting it, the image preview
instantly displays on the screen, which is nice. Apparently this
process is being handled locally --- could someone try to re-create
this ? ... I imagine its using DHTML or some other technique, I'm not
sure how I would code this.

View 1 Replies View Related

Passing Data Back And Forth With A ASP.NET IFrame

Jul 23, 2005

I'm trying to communicate between a parent document that is controlled
through pure Javascript with an embedded IFrame containing an ASP.NET
form. I can quite easily pass data into hidden fields in the IFrame and
submit the form to pass data to the ASP.NET application.

Now the tricky part! (at least for me, probably not for everyone
else!), how can I set a field in the ASP.NET page (using ASP.NET during
a postback), which I can get the value of within the parent Javascript
controlled page?

View 3 Replies View Related

JQuery :: Passing Information Using Data()?

Sep 30, 2011

I am using jqueryUI dialog, and want to pass some data to it. data() seems the best method, right? The following works. $(".delete").click(function(){$("#dialog-delete").data('row','Hello').dialog("open");}); Now instead of just passing a single value, I want to pass an element. I tried the following, but am obviously doing something wrong. $(".delete").click(function(){$("#dialog- elete").data('row',$(this).parent()).dialog("open");});

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved