Assign Multiple Variables At Once?
Mar 16, 2010
Is it possible to assign multiple variables at once? For example:
var int1,int2,int3,int4,int5 = 0
I'm just wondering because I did this without thinking and my program never gave me an error and everything worked fine. Is it because these variables are set to 0 by default or what? If it does work, are there any other languages that this works in such as vbscript?
View 4 Replies
ADVERTISEMENT
Jul 10, 2010
I'm trying to learn JavaScript on my own and am using a Dashcode example (if anybody uses Dashcode, the example is the "Browser" web application template that is shown when Dashcode opens).
Briefly, the JavaScript generates a list of "Locations" in the USA:
Code JavaScript:
// Sample data. Some applications may have static data like this, but most will want to use information fetched remotely via XMLHttpRequest.
var parks = [
[Code]....
I want to retain the layout and structure but, depending on the "Location" have different text for each of the new pages (not "the scenery is amazing etc).
View 4 Replies
View Related
Dec 14, 2010
How do you assign multiple onfocus events to a input tag? code...
View 11 Replies
View Related
Nov 15, 2010
i have 3 links... (eg. stomach, brain and heart). and also 3 images (stomach.gif, brin.gif and hear.gif) when i click stomach i want to display the image of stomach and hide the rest. ALSO there are another 2 links (view cross-section, and view inside) and images associated with this if stomach is selected, clicking the 'view corss-section' should display corss-section image of the stomach (together with the stomach image).....if brain is selected, clicking 'view corss-section' should display corss-section image of the brain..
View 6 Replies
View Related
Nov 22, 2010
is it any shortcut for these lines of code:
$("#div1").fadeToggle("slow", "linear");
$("#div2").fadeToggle("slow", "linear");
$("#div3").fadeToggle("slow", "linear");
i mean assigning a function for multiple objects, i testes code below, but it didn't worked out:
$("#div1").$("#div2").$("#div3").fadeToggle("slow", "linear");
View 6 Replies
View Related
Jun 29, 2010
The following works in php but not in javascript.
if((dobyear==false) && (dobmonth==false) && (dobday==true))
{
return 'noyearmonth';
}
View 3 Replies
View Related
Sep 12, 2003
I'm trying to pass multiple variables using a url on a Java function call.
the code I have that passes the 1 variable is:
function HandleChange() {
parent.CustomerIf.document.location.href="CustomerReturn.asp?id=" + varName.options[varName.selectedIndex].text;
}
which passes the chosen data (being loaded from a database) from a drop down box on an onchange event in asp script.
What I want to do is pass multiple variable via the above url script that the next page will get by the request.querystring method.
something like this:
function HandleChange() {
parent.CustomerIf.document.location.href="CustomerReturn.asp?id=" + varName.options[varName.selectedIndex].text + "address=" varAddress.value;
}
View 4 Replies
View Related
Jul 23, 2005
I'm having a problem passing a variable through a URL because the
variable is supposed to hold a URL that has a variable of its own.
Here is an idea of what I'm trying to do:
href="javascript:
newWin('/vcrc/exitvcrc.jhtml&newURL=http://www.something.net/default.asp?sponID=ETC','NowLeaving',駼',
餠', 'no', 'auto','no');"
So, pretty much, the page I'm sending the variable to think there's two
variables (newURL and sponID), but sponID is part of the URL.
View 2 Replies
View Related
Nov 3, 2009
I'm trying to pass data to my mySQL database, but I'm doing that 2 jQuery scripts:User comes on my page where there is a list with some values, e.g 530, 532, 534 etc etc ..User clicks on one of them, this link is using the jQuery to get another php file which get's the data from my DB and list it below the first list, here's the code for this:
$('#letter-e a').click(function(){
$.get('e.php', {'depot': $(this).text()},function(data){
$('#dict').html(data);
[code].....
So the second list is another step that can't be avoided to get the final result. In other words, i'ts another list where the user has to chose one of the items from the list to see the final result, I've added this code inf the 'e.php' file:
$('#letter-f a').click(function(){
$.get('f.php', {'date': $(this).text()},function(data){
$('#entry2').html(data);
[code].....
The problem is that my 'f.php' only gets 1 variable value, but I'll need 2 or more (maybe in the futur), how to pass multiple variables to a php file using jQuery?
View 2 Replies
View Related
Jul 8, 2010
I'm using AJAX to, on the click of a button, run a PHP script that dynamically generates a new line of text, and passes that to the script.The PHP script, new_sentence.php, just echos out the sentence.This works fine.But what I would like to do is for the PHP script to dynamically change JavaScript variables.how to pass multiple variables from PHP to JS.I can, of course, pass one by having the PHP script echo anything, and then use JS to set the variable to the PHP output. But what if I wanted to set two or three JavaScript variables at once?Here's my code in the HTML page that contacts new_sentence.php:
Code:
function ajaxRefresh(){
var ajaxRefresh;
ajaxRequest = new XMLHttpRequest();[code].....
When I press the "Refresh" button on the HTML page, it runs the ajaxRefresh function, which calls new_sentence.php. Then, once it gets the response, it changes the text of the element named "div" to whatever text the new_sentence.php echos.I'd like to figure out how to get a couple of variables.I would imagine this is simple. how to set the variables in PHP and then how to retrieve them in JS.
View 4 Replies
View Related
Feb 13, 2010
Is it possible to pull multiple variables from a single dropdown menu selection?
Example:
I have this:
function material_choices_menu() /* Provides Specific Gravity for various materials */{
var data = "Material <select name='material'>";
data += "<option value='.926'>CYCOLAC MG47 (ABS)</option>";
data += "<option value='1.050'>CYCOLAC MG47MD (ABS)</option>";
data += "<option value='.958'>CYCOLAC T (ABS)</option>";
data += "</select>";
document.write(data);
}
I'd like to have multiple option values:
function material_choices_menu() /* Provides Specific Gravity for various materials */{
var data = "Material <select name='material'>";
data += "<option value1='.926', option value2='.005-.008'>CYCOLAC MG47 (ABS)</option>";
data += "<option value1='1.050', option value2='.005-.008'>CYCOLAC MG47MD (ABS)</option>";
data += "<option value1='.958', option value2='.005-.008'>CYCOLAC T (ABS)</option>";
data += "</select>";
document.write(data);
}
I plan to use the first value in some math formulas to determine weights and the rest of the values will just be shown as data for the user and/or possibly a link to the datasheet for the material selected.
View 6 Replies
View Related
Jul 1, 2011
I am creating a quote calculator as a mobile app using the JQuery Mobile plugin in Dreamweaver CS5.5. This supports HTML5 & Javascript.
I have included a drop down list in which the user selects a specific Annual Volume. I have 2 different calculations that need to be done based on the users selection. Different calculations meaning that I need 2 different number values assigned to the option.
For Example:
Calculation #1 (I'm calculating what the Run Quantity is based on what the user selects as the Annual Volume. If user selects an Annual Volume of 150,000 then the calculated result for Run Quantity needs to be 3500)
HTML for this scenario:
<li data-role="fieldcontain">
<p><span class="ui-listview-inset">Annual Volume:</label>
<select name="annualvolume" id="annualvolume">
onChange="Calculate();">
[Code].....
Currently I am simply having the user enter the annual volume twice so I can do the 2 calculations, but this is really clunky and not ideal.
View 13 Replies
View Related
Sep 5, 2010
I'm new here, and new to js. Here is my problem: I have written out a code to make an image switch from state 0 to 1 and back to 0 again (an eye blink). The code works fine, but I would like to write the functions with arguments so it could be applied to more images. I have tried for a few hours (and searched forums) and am getting no where. Here's my code.
Code:
function home_blinkDown()
{
//alert('blink down');
var t = setTimeout("home_blinkSwap('home_js', 'images/main/home_blink.png')", 2000);
[Code]...
View 5 Replies
View Related
Oct 19, 2010
I've recently begun using AJAX on my website and have ran into a problem.My webpage: catalogue.php contains a category variable named $cid which the page GETS in order to display products from the correct category. This works fine.I now want to implement a drop-down box to sort by price, name, newest etc...I have tested the AJAX out with a dropdown box for changing the category and it works fine, this is because it is only passing one variable which it gets via the javascript "this.value".
The sort by price box requires two variables to be passed .I can pass the "this.value" which tells the javascript function I want to sort by price/newest/etc but I cannot figure out how to pass the category variable ($cid) so that when the xmlhttp.open calls the url: getSort.php it passes both pieces of info.My javascript is:
Code:
function showSort(str)
{
var cat = <?php echo $cid ?>;[code].....
View 5 Replies
View Related
Aug 23, 2009
I have multiple triggers and I am trying to pass variables via a "rel=" tag (which are unique id's) for each trigger I can get most of it working, problem is that since there are multiple triggers with id="newsTrigger" only the first listed trigger works Using PHP/mySQL. An example trigger is:
while loop{
echo '<span id="newsTrigger" style="font-size:0.8em;" rel="'.
$rowNewsid[$counter].'"><a href="'.$rowNewsPermalink
[$counter].'">'.substr($rowNewsHeadline[$counter],0,40).'</a></span>';
}
The above outputs a large number of rows with the same span id of "newsTrigger". When a user mousesover any of the newsTrigges I am trying to get an ajax dialog to load up content based on the id that is being passed through the rel tag. How do I do this? The javascript so far is:
<script>
$(document).ready(function(){
$("#newsTrigger").mouseover(function() {
var newsid = $(this).attr("rel");
[Code].....
View 1 Replies
View Related
Apr 9, 2010
I was wondering how you would list multiple variables after a equal ==?
Example....
if ( pathname == schoolinformation, chaplainchatter)
$('#button_newspress_archive,#button_tech_college,#button_parent_portal,#button_transition_portal,#button_6th_form,#button_connect,#button_vacancies,#button_vle_login').css('display', 'none');
$('#school_information_sub').css('display', 'block');
if ( pathname != schoolinformation, chaplainchatter)
$('#school_information_sub').css('display', 'none');
Or even list multiple URL's within the variables?
Example
....
var schoolinformation = '/st-paul-s-website/school-information/school-news/headteachers-headlines', '/st-paul-s-website/school-information/school-news/chaplain-chatter-headlines';
View 3 Replies
View Related
Jan 7, 2011
I have been working on a few budget scripts that I can access from the web in using HTML. My problem is that when variable values change I need to change these values in all of the HTML files on the server. I know that there is a way to declare global variables in a single file and use those values in another file but I have not been able to find any information that tells me exactly how to do this. I have tried to put it together on my own using what little informaiton I have been able to find but have not been able to get this to work. Is there a more detailed referance that I can find somewhere or does anyone know what steps I need to take to make this happen?
View 13 Replies
View Related
Aug 22, 2011
I am trying to make an image swap to another image, based on two variables.
i.e. Change an image of a blue car with silver wheels to a red car with black wheels.
The variables are the 1. colour of the car and 2. colour of the wheels. The visitor to the page will click on a coloured car icon to swap the image to the correct coloured car and then on a coloured wheel icon to change the wheel colour.
I have pre-prepared jpegs of all of the combinations of car/wheel colour.
Not sure at all about how to do this, or even if Javascript is the right way to go.
View 1 Replies
View Related
Sep 3, 2011
First off I didn't know whether to post this here or in the PHP section since it deals with both, but mostly JS. I have a PHP scraper that scrapes the job title, company name and location from a website and stores them in separate arrays. These values are then extracted out one at a time from the array and stored into a string, that is then passed to a Google Maps API.
I can make this successfully happen once, the thing is I need to do it multiple times. I have an idea on what I should do but don't really know how to implement it (correctly). The idea I had was to create a function in the JavaScript section that accepts three values from PHP. This function would be called in my PHP for loop that extracts the values from the array into a string. The thing that confuses me is that the Map function is called via <body onLoad="initialize()">. Here's the link to my code (http://pastebin.com/rTfzJM16)
View 1 Replies
View Related
Jul 20, 2009
I have used AJAX lots before and I wondered if it was possible to set variables from an AJAX file E.g. an ajax file could set
var set1 = 10;
var set2 = 55;
with both variables coming from an external file called by AJAX. Which JS side perform the request and the format of the file that is requested.
View 4 Replies
View Related
Feb 4, 2010
I am currently working on a function that will allow the user to search for an event by date and category. I've been using the w3schools exercise as an example but i wish to pass 2 pieces of data instead of one and am not sure how to do so. I'm sure similar posts have been raised before and i apologise if this type of question has already been answered but i could't find it in the forum index.
<FORM name="myForm">
<INPUT type="text" readonly name="MyDate2" value="Click for Calender" onClick="toggleCalendar('MyDate2')"size="15">
Select a Classification:
<select name="Classification2">
[Code]...
Even just point me in the direction of a good article or tutorial, i've been banging my head against it for 2 days so i'm very willing to take a few hours to go through a tutorial
View 9 Replies
View Related
Jul 14, 2009
Many time i am getting one problem with Jquery when i am using more then one jquery plugin on same page then only one plugin works which will be on top. I guess few variables mixing and disturbing to each other. I just want to know is there any way to control it?
View 9 Replies
View Related
Mar 8, 2010
how to accomplish this. In my website, I would like the user to input text into a single or multiple textbox(es) and then have the contents of the textbox(es) stored to either a variable or an array. Then I would like to have that variable/array compared to other arrays. Basically, the user is searching for items in a database. The user can search for as many or as little items as they want. Then the item(s) will be compared to multiple arrays to find out if what the user wants is in the database.
So for example, let's say the user is searching for recipes that have all or part of these ingredients: chicken, broccoli, lemon, honey. So, there would have been a total of 4 textboxes...one for each ingredient. These ingredients are stored to an array..lets call it ingredient(). In the database of recipes, each recipe has its own array which includes the ingredients needed to make the recipe, we'll call them tag1(), tag2(), and tag3(). Now, I want the array, ingredient(), to be compared to each of the "tag" arrays to see if any of the "tag" arrays include exactly match the ingredient() tag in part or in whole. Is this possible?
View 2 Replies
View Related
Apr 2, 2009
Anyone know how to get Javascript variables into PHP variables or a MySQL database? Full question in the PHP section.
View 2 Replies
View Related
Feb 3, 2011
I have some JavaScript which is splitting out the different variable elements from the URL.Now, how do I set the internal variables?Then I want to set the variable ScriptHeading to be Change and the variable ScriptType to be NewThread.I keep finding all sorts of lovely code showing how to split out the various sections in many different ways, but I can't find anything on how to actually set these variables.
View 1 Replies
View Related
Jan 9, 2011
What is the correct way to work with multiple language JavaScript files? So how to use your PHP language variables in your JavaScript files? The way I do it now is create JavaScript files like 'script_js.php' like this:
[Code]...
View 10 Replies
View Related