Send Variable To Url Using Onclick?
Jan 16, 2009I know how to pass a variable to a url using href.
(href="thisurl.php?thisvar=thisvalue")
now I want to do this using onClick, how do I?
I know how to pass a variable to a url using href.
(href="thisurl.php?thisvar=thisvalue")
now I want to do this using onClick, how do I?
I am trying to set up a five star rating system, I found a stock framework that I am adding to but I ran across a problem.
I cannot get the rating "number" to pass through the AJAX get call:
Code:
/*
Author: Addam M. Driver
Date: 10/31/2006
*/
[Code]....
The problem is in the sendRate function. It has the variable sel passed into it, and if i try to send sel.title it passes the title according to what the user selects, however, if i try to just pass the "sel" it doesnt get through..
how to send the value of "sel" variable to me perl script?
Here is the script I am using code...
I'm not very familiar with javascript, but I want to get a variable called $page and then set it as the save.php?savepage=$page link. Anyone please tell me how to do it?
I need to display the variable from PHP to ( POP ) JavaScript
$mess = "ERROR .. Please Enter the name";
Display ( $mess ) in POP Windows JavaScript.
I was wondering if there's way to send a variable's value to my email.
View 11 Replies View RelatedI am trying to send a variable between flash and js. the javascript is on the same html page. and since nothing is working i tried the most basic thing. in the html i have an alert like this:
Code:
Also i have in the body of the html the tags to hold the flash and i added an id:
Code:
And in the flash i have a btn that has this:
Code:
I think it is all correct but IT IS NOT WORKING! not in firefox and not in ie6 so i am thinking that it is some thing with my browzers or my computer (in other cases i do get an alert message so i know the js is working).
I wanted to know if there is way in Javascript to send a hidden variable to an external URL without actually submitting to the URL?
Code below is what I intend to do. I want to use an image to do an onClick event and send the name to an external URL without actually doing a submit.
<td width="25"> </td>
<input type="image" src="images/btn_Activate.gif" onClick="window.location.href='www.abc.com'">
<input type="hidden" name="name" value="<% = name %>">
</td>
I am trying to pass a php variable to a javascript file via a link. The link is set up as follows: <a href="video-details.php?src=<?php echo $row_videos['YouTube_Ref'];?>">
The javascript variable is a s follows:
Code:
var id = 'flash';
var src = "<?= $src ?>";
var params = {allowScriptAccess:"always"};
[Code]....
I can't get this to work for some reason
i'm not really sure how to explain this, since I know nothing about javascript, so i'll try and illustrate by the use of php (hope it makes sence)
I have a set of different links, like:
<a href="link.com?page=text1">text 1</a>
<a href="link.com?page=text2">text 2</a>
<a href="link.com?page=text3">text 3</a>
etc, where page is dynamic and can be anything I chose..
Another place in the same document, I echo out what the page variable is, like:
echo "$page";
so when clicking "text 1" the echo will output what i've defined the page to be, in this case "text1" ..
So I want to be able to click the links and change the output of the echo all depending on what i've defined in the link - without refreshing the page!
Is there any easy way to do this?
As it is shown in line 2 does everything perfectly, but I must declare the variable outside the function, as it implies the following code (line 1).
marcel
var
wert = "text";
$('#bChange'
).click(function() {
$.ajax({
url:"content/nextpage.php",
type:"POST",
timeout: 5000,
dataType:'html',
cache:false,
data: { rNeuRecht: wert },
success:function
(msg){
$("#leer").html(msg);
}});});
$('#bChange'
).click(function () {
$.ajax({
url:"content/nextpage.php",
type:"POST",
timeout: 5000,
dataType:'html',
cache:false,
data: { rNeuRecht: "text" },
success:function
(msg){
$("#leer"
).html(msg);
}});});
I have a base html page which contains several thumbnail images with links to enlarged images which I'd like to view in an external page [so I can control the dimensions of the enlarged image]. I thought it best to use an externaltemplate html page to launch these within and therefore imagine I need to declare the variable in the thumb links page & image they may need to look something like this:
<a href="mytemplate.html?imgVar=/images/collection/large1.jpg">thumb1.jpg</a>
<a href="mytemplate.html?imgVar=/images/collection/large2.jpg">thumb2.jpg</a>
<a href="mytemplate.html?imgVar=/images/collection/large3.jpg">thumb3.jpg</a>
Then in the external page pick up the variable something like:
<img src="imgVar">
I've looked all over Google & can only see something similar to this in php. Is there a way to achieve this with jQuery instead?
I want to be able to send data store in JavaScript variable to my email account.
I have tried using mailto: command and for some reason it doesn't work.
i am trying to create a form that where the page will not refresh if the form is submitted specially if the user inputs any errors in the form my problem is i do not know how to send multiple variables using jquery to a php file i saw somewhere that in order to do this you need to concatenate the variables you will be sending this is the code i am using
<html>
<head>
<style type="text/css">
#add(display: none;}
[code]....
the jquery successfully sends the variable to the php file the problem is once i insert it into a database all the variables i sent are concatenated for example in the column stud_no once you send the form this is what will be inserted "123123name=asdasd"
my page has the following code:
<td><ul id="seatplan">
<li class="seat_01 A"><a href="javascript:seat()" id="01A">01A</a></li>
<li class="seat_01 B"><a href="javascript:seat()" id="01B">01B</a></li>
<li class="seat_01 C"><a href="javascript:seat()" id="01C">01C</a></li>
[code]...
Code:
The above JS code alerts when the following link "id's" clicked
Code:
What i want is, NOT THE ALERT..bt somehow to send the "id" name to the textbox like "01A" when they are clicked:
Code:
I am trying to apply the current value of variable i to the links onclick event
I've even tried assigning it to variable j but the only values I get when any link is clicked is
i = 5
j = 4
The "page"+i and "Link"+i show as they should with variable i showing the correct value. Code:
I have a JS variable I want to write inside of a onclick="" attribute. Example:
<script>
var cool = "hello";
</script>
<a href="#" onclick="RunFunction(cool)">Text</a>
I'm looking to send a loop variable (i) to a function inside the loop, but I can't seem to get it to use the value I want, it keeps making it a reference of i and therefore the function is always called using the last value of i rather than the one it was set with.
So if i have 5 Tabs then Tab 1, when clicked, should call DefaultTabClick(0) and so on rather than always using 4 for any of the tabs.
Basically, I have a form with some text fields, and I want to put a button next to each text field, so that when a user clicks on the button, it increments the value in the field by 1. I know how to do it if I know the id of the text field, but what if the id of the text field is a variable? How do I do it? Here's my code:
<script language=javascript>
function process(v){
document.getElementById('order_item' + v + '_quantity').value++;
[code]....
My issue is with my onclick statement:
<input type="button" value="Add +" onclick="javascript:process(0)">
This works fine for my first field, but I need to have one for every text field, so how do I pass my counter variable (which determines the id of the appropriate text field) to the process function?
I have a book on my page consist of 3 iframes, 1 iframe opens the table of contents and 2 iframes to open 2 pages at the same time, also i have 2 buttons to navigate pages next and previous through this function
[Code]...
the problem starts here, if i click on next-previous button I want it to continue from page 36,37 but what happens it continue from pNum in the function, how to update the pNum from onclick ?
I am building a site where I want all links to partial page reload using xmlhttprequest and innerhtml. I have done this before, butI always had to have a seperate xmlhttprequest function for each link. So this time I am trying to write just one function, and have the onClick change which document the request is getting. It is not working and I appear to novice to figure out why. Here is the code, i have bolded some relevant lines:
<script type="text/javascript">
function ChangeContent()
{
var whichPHP;
[Code]....
Also, if I use the innerhtml function to write another of these hrefs, will that link be able to access the function if it is in the header, or should I put the entire function in a .js file on the server? The point of all this would be that the entire page never reloads and all the text content is swapped out on demand.
I am trying to use an onclick statement to go to an alternate web page displaying a different version of tha file being displayed in the current page.
In the HEAD section of the current page I have a global variable named currentfile that contains a file name. This function is also in the HEAD section immediately below the variable's declaration
I have tried every combination I can think of in the onclick code to get it to work but, no joy. here is an example:
I just can't get the next page to load.
I am trying to access a dynamic asp variable with onclick either in a javascript function where I can use it globally or set another div id with this dynamic variable.
<script>
function doSomething(article_id)
}
[code]....
I have a form, that when the user click Submit, I need a php variable to be echoed to the page. This is for an upload page. So when they are waiting for the file to upload, it will say "Uploading..." until the upload is complete.
All I know so far is I need to create a javascript function and include it in the submit button. This is all I have so far in the submit button tag:
onClick="Transferring();"
I'm trying to make a basic rss reader with a google reader-esque functionality of clicking on article names and being able to expand/collapse that article. I'm working on the expand part and am going crazy. I am having no trouble getting content and displaying it without the onclick function but when I try to integrate onclick I can just get the titles.
[Code]...
I have this web application where users are able to fill out and submit reports. The reports and scripts are part of a whole system, that is, they are used on a couple of different clients written in both vb and c#. This is the web-version of those clients.The scripting language is javascript and is executed using different script engines on the different systems. But for the web-version it is just executed in the browser.The different fields in the report can be accessed by typing:ID1.value. To get ID1 to apply for the input-field with id ID1 I had to in the initfunction of the page write a window["ID1"] = document.getElementById("ID1");
But my problem is when this element change. Cause in the report I have a special element that in the browser is translated to a table-element with a report-field in each cell.When I switch the current row, I need to update the window["ID1"] to equal the correct report field on the selected row. But when trying to access the new variable ID1 from a buttons onclick event it is undefined.<input type="text" id="test" onclick="alert(ID1.value);" />What I think happens is that when the page is first drawn the onclick event is created and as I understand, variables inside an event has the same value as when the event was created.
So if ID1.value was something when the page was created it will be the same when it is called even if the value of ID1 is different. And that seems to be the case. When I debug the page, before entering the event, ID1.value has the correct value while inside the event it is undefined and after the event it has the correct value. If I write window["ID1"] correct value is also shown.But a weird thing is that in another place in the code I had the same problem but instead of having the code inside the onclick event I first had a global function changeActiveRow and inside that I had an eval, eval(document.getElementById("ID1_script")) where ID1_script is a hidden element whos value is a script using ID1.value and that works.