JQuery :: Passing Parameter To Click Function From Anchor?

Jun 9, 2010

my first attempt to post seems to either have been rejected or simply gone into the cyber void.

I currently have a link on a webpage as follows:

<a href="#" id="loadData"><img src="images/bookcase.png" alt="" width="114" height="167" border="0"></a>

which is picked up by

$("#loadData").click(function()
which then executes:
.load("subgenre.php" , function() etc

What I want to be able to do, however, is pass a parameter to the php script, along the lines of:

.load("subgenre.php?param=" + passedParam , function() etc

View 3 Replies


ADVERTISEMENT

Passing Parameter On Click Event?

Apr 28, 2011

i dont know how to do this?

<script language="javascript" type="text/javascript">
function ShowHideDiv()
{
var myDiv = document.getElementById("LoginDiv");
if(myDiv.style.display=="none" && '<%=_Type %>' =="Sign in")

[Code]...

just tell me how to pass parameter from this function ShowHideDiv() and how to use this?

View 11 Replies View Related

JQuery :: Passing An Object As A Function Parameter?

Jun 27, 2009

I had a script that was acting unexpectedly because of a function parameter. I was trying to pass a jquery object through a function to attach some events. I was wondering if someone could tell me why this
didn't fly:

[Code]...

View 3 Replies View Related

JQuery :: Passing Additional Function As Parameter?

Jul 20, 2011

I know its a cliche but I am new to JQuery. I have seen many posts about passing function as parameter but none is what I am looking for. Not too sure if its possible but no harm asking.I have a function that trigger a modal

function InitNewModal(URI,Title,Width,Height,Params)
{
// Begin modal function

[code]....

View 4 Replies View Related

Passing A Function Within An Anchor Tag

Jan 12, 2007

I have a questionregarding passing a function within an anchor element href
during dom scripting using javascript. for eg:

the xslt file contains
<a href="javascript:{@test}('{@value}')">

how will i write this in javascript. Basically the xml file has

test = "help" and no value parameter in this particular xml file currently

the basic idea is to pass help('') in href of anchor tag
the help function is already defined.

i have currently written as:
var help = element.getAttribute('test');
var value = element.getAttribute('value');
elementA.href = 'javascript:help + '(' + value + ')'

value should be equal to ' ' where as in my case it is returning null and not sure on the syntax that i am using for href.

View 1 Replies View Related

Passing Function Parameter Into GetElementByID?

Oct 3, 2010

I am trying to pass a variable into document.getElementById and it is returning a null value. I am hoping someone can identify my error and point it out. The frustrating thing is, I got it to work and then changed the code and screwed it up again...ugh. Anyways, here is the HTML side of it (an onclick event in a button, calling a function with these arguments):

Code:

<input type="button"
id="AddHeader"
name="Add Header"
value="Add Header"

[Code]....

FireBug shows the problem is with the first line of the function - it's assigning myDiv null instead of what I want it to assign it (div#myDiv1 I think).

View 5 Replies View Related

JQuery :: Pass More Than 1 Parameter To Click Function?

Jun 10, 2010

I currently have the following:

<a href="#" id='$dbase'>Link</a>

which passes the value of $dbase to my jQuery click function.

But I'd like to also pass a second parameter consisting of a page number. Can that be done using the click function or would I have to do it another way. I'm assuming it must be possible. I suppose i could always concatenate the two parameters, e.g. $dbase-$pagenum, pass that and then split it in the javascript but that seems a slightly inelegant way of doing it.

View 2 Replies View Related

Passing A Parameter By Reference To An ActiveX Function

Dec 12, 2005

I have develop an ActiveX with Visual C++ 6

And I will call functions on this ActiveX from a javascript.
I know how to instantiate the activex object (with the balise <object>).

But how can I do to call a function of my ActiveX and pass to this function
some parameter by reference.

Here is what I have :
the function in the ActiveX :

void test(long *t, long FAR* nb)
{
t = 3 ;
}

And here is what I try to call this function in javascript:

var myT = 0;
my_control.test(myT); // here is the problem that
alert("T : " + myT);

But I receive the value 0

So how can I do to pass parameter by reference to a function of an ActiveX?
Is there anything to change in my function in the ActiveX?

View 2 Replies View Related

Passing Array As Function Parameter In FF And MSIE?

Dec 7, 2010

why this code works in FF, but fails in MSIE? In particular the content / display of the <select> options.

What is different in the executions of the same script on different browsers?

What can I do or change to make it work in both browsers?

Code:
<html>
<head>
<title> Pass array by reference </title>
<script type="text/javascript">

[Code].....

View 2 Replies View Related

Passing Parameter In Window.onload Function

Aug 18, 2011

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
[Code]...

How can I still use the parameter "openAccordionID" in the blue-highlighted part? I tried, but it failed.

View 4 Replies View Related

JQuery :: Click Function On Anchor Element?

Jun 10, 2009

I'm confused as to why when I have:

$('a').click(function(){
alert(this);
return false;

[code]....

View 4 Replies View Related

JQuery :: Click Function Of Anchor Tag Not Working With Href Other Than #?

Jul 25, 2011

I started with the simplest step - the hide() function:

$(document).ready(function(){
$("a#p").click(function(event){
$("#HiddenDiv").hide();
})
});

It worked fine as long as the href attribute of the anchor tag was '#'. Then I tried using href other than '#' and ran into a problem. I just changed the href to:

<a id="p" href="test.php">Click me</a><br />
<div id="HiddenDiv">Testing mate</div>

test.php is the page in which both these sections (html and jquery) are present, so like a postback to the same page.

This method didn't work and on clicking the anchor tag, the div stayed visible.

I then tried theevent.preventDefault(); method and that worked.

So I experimented more. I tried using the hide function on a dynamic link, something like test.php?a=1.

I ran into a problem again. The div remained visible on clicking that link.

View 17 Replies View Related

JQuery :: Anchor Tag OnClick With A Parameter?

Feb 4, 2011

I am trying to call an ajax function from the onclick event of an anchor tag. Currently I reference the function like this. I would have liked to bind the function to the anchor tag but did not know how to do that when I need to pass in a parameter?

<a href="#" onClick="getCredentialFromId(${link.id})">${link.name}</a>

link.id and link.name are rendered on the serverside so when the page is rendered it looks like this:

<a onclick="getCredentialFromId(35)" href="#">MySQL</a>

my function looks like this:

function getCredentialFromId(cred_id) {
$.post('link.htm?linkCredentials',{cred_id: cred_id},function(response) {
try {

[code]....

View 1 Replies View Related

JQuery :: Passing Information To A .click Function?

Apr 18, 2011

I have a basic understanding of selecting elements and performing manipulations or effects, but I'm having real trouble grasping the basics of setting up variables, performing maths on variables and biggest of all, how you go about passing information from the HTML into a jquery function.

I have a site where clicking on any photo thumbnail brings up a full-screen lightbox to display the image full-size - I'm using the following to bring in the lightbox:

$(".photo").click(function(){
$("#lightbox").css({"visibility":"visible","z-index":"2"});
$("#lightbox").stop(true, false).animate({opacity:1},800);
});

This works just fine, I also have no problem re-assigning the SRC of a blank image within the lightbox to make sure the correct image renders, my problem is I just don't know how to generate or pass information into this function to begin with to act as a reference point so the code knows what image it should be displaying based on which thumbnail was clicked.

I don't need anything particularly clever, even if each thumbnail simply had a numerical figure associated with it (eg "4") which gave the function something to work with once it was fired - that would be enough.

I know how to do all this in regular JavaScript but I have to admit I'm finding the documentation for jquery really hard work, I'm having real problems grasping the fact that the functions aren't being triggered directly by the HTML.

Another solution would be to get the src of the image that was clicked on, split the string and pull out just the filename (ie 5.jpg) and then prepend a path to it for the final full size image ( largeimage/ + 5.jpg).

I know there are probably pre-made scripts for this kind of thing but I'd like to try and avoid them if possible.

View 2 Replies View Related

Passing A Variable To A Click Function?

Aug 3, 2011

I have a DOM click event that creates a <span>. When the user clicks a button, it turns that <span> into a textarea that the user can type a new name in, press enter, and then the span contains the text the user input. Sort of like when you rename a file in Windows Explorer.

Anyway, the code is something like this, and I'm wondering if I can use 'area_el' in this way... right now it's giving me the error that area_el is undefined, even though I define it in the function that contains the Event declaration.The first part is the Dom stuff to make it all work. It's not stuff I need to mess with, but I'm putting it here in case it's useful.

var Dom = {
get: function(el)
{

[code]...

View 6 Replies View Related

JQuery :: Passing Parameters Through Anchor Tag?

Jun 7, 2010

I am new to JQuery and trying to post some parameters from an anchor tag. But only my 'site' parameter gets passed. Here is my code :

<a class="screenshot-link" href="#" site='dv2' num='1'>1</a>
$(
".screenshot-link").click(function () {

[code]....

View 6 Replies View Related

JQuery :: Passing A Anchor Id To Open Accordion?

Aug 2, 2010

I have created a simple accordion that hides and shows span tags when the corresponding h3 header is clicked.

The Jquery:
$(".accordion span").addClass("answer");
$(".answer").hide();
$(".accordion h3").click(

[Code]....

However, I cannot work out how to test for the anchor and open the associated span tag

View 2 Replies View Related

JQuery :: Set An Onclick Event With Passing A Variable As A Parameter?

Mar 20, 2011

what i want to do-

$
(
"#temp"
).

[Code]....

View 1 Replies View Related

Passing A URL As A Parameter

Oct 9, 2005

I have a javascript function that is called in an OnClick event for a
button.
I am attempting to get the function to open a web page in a new window
in response to a button click.

I can get the page to open if I use the following syntax (hard code the
address)

var newwin =
indow.open("http://www.w3schools.com","","width=1200height=1000");

However, If I pass the url in as a parameter to the function (as below)
the value passed in is "Undefined" and obviously the page will not open

function openThePage(url)
{ url = "http://www." + url;
var newwin = window.open(url,"","width=1200height=1000");
}

<input
class="mybutton"
type="button"
name = "W3Schools"
value="w3schools.com"
onclick="openMyUrl(W3Schools.Value)">
&nbsp;&nbsp;

Anyone any idea how I can do what I want - what I am doing wrong. I am
grey enough as it is and I don't want to start pulling my hair out.

View 1 Replies View Related

Passing More Than One Parameter?

Apr 28, 2010

I am trying to pass the appropriate parameters but nothing seems to be working?

function calcSubTotal(unitPriceId, qtyId, subTotalFieldId) {
var unitPrice = parseFloat(document.getElementById(unitPriceId).value);
var qty = parseInt(document.getElementById(qtyId).value);
<tr>
<td><table><tbody>

[Code]....

View 2 Replies View Related

Passing A Parameter Via URL?

Jan 25, 2010

I am looking for a simple script that can read the parameter from the URL and pass it into a HTML textfield element.

www.example.com?email=test@test.com

On the page the email text field should be pre-populated on load.

View 1 Replies View Related

Call The Click Event Of The Link (anchor Tag) On The Click Of The Button?

Jan 24, 2011

I want to call the click event of the link (anchor tag) on the click of the button. I used this code below in the click event of button to call links click event and it works fine in IE.

document.getElementById('linktag').click();

But, this doesn't work in Firefox. I googled a bit and found that in firefox, you have to do something more to achieve this behaviour. So, I ended up doing this on button click to work in firefox:

var link=document.getElementById('linktag');
var e = document.createEvent('MouseEvents');
e.initEvent(

[code]....

The above code does the click on link when I click on the button. But my problem now is that I have defined a link as

<a href="mailto:abc@xyz.com?subject=abc&body=email body">email </a>

and when click is called and mailto links opens my email client, it somehow ignores the subject and body parameters of the link. It works properly when i actually click a link element. but it doesn't work when i simulate the click event by code written above. above dispatching event code somehow ignores the link parameters?

View 3 Replies View Related

Passing Parameter To Servlet ?

Aug 2, 2011

I'm working on a web page, it has a form and a

Code:

In the head i have the script

Code:

Now, i need to pass 3 parameters from the jsp to the script in such a way to pass them to my awedit servlet. Is it possible? How do i do it?

View 2 Replies View Related

Passing A Parameter With The Value Of A Variable

Sep 15, 2009

I've been staring at this same problem for over a week now. I've worked around it as best as i can but i think it's time to ask someone else for input.

I'm trying to pass a value thru an ajax parameter.. that's all. it SHOULD be easy in theory.

What i want to do is create a jscript variable then pass that variable as the value for a parameter.

Php then converts that value to something it can use to finish the rest of my code.

As i said it's hindering my webpage progress and i would like to get it fixed soon.

View 13 Replies View Related

Ajax :: Passing The Id Parameter?

Mar 1, 2007

I am trying to pass an element's id to an ajax function so that I can update different areas by passing different ids to the same function, but I am not quite sure how to get it passed to where I want it to go.

Code:

function calGet(date,month,year,id,action) {
xmlHttp=GetXmlHttpObject();
if(xmlHttp==null) {//ajax won't work, redirect to a calendar php page to display the event with php

[code]....

In the function calGet I passed a parameter 'id'. I want to get this parameter down into the getElementById area in the stateChanged function and I've tried, many many ways, but I cannot figure it out.

View 4 Replies View Related

Passing Dynamic Id As Parameter ?

Apr 24, 2010

Here are the two functions:

Code:

Here is the code for the form where the tables are added:

Code:

This is what i want to do: When the user clicks "Add a New Page", it adds a table with the id="pageX" and a delete button with the id="deleteX" where X = the next page number.

When they click deleteX it should make pageX table display:none and assign a value to deleteX.

I got it to do everything except for assigning deleteX with a new value. the code that makes the delete buttons not work is:

Code:

View 1 Replies View Related







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