Can't Pass 2 Parameters On An Onclick In Href

Apr 12, 2010

I am having some issues with getting a variable from an onclick event with javascript.

$('#preview_logo').append('<img src="'+fileObj.filePath+'" height="100px" hspace="5" /> '+fileObj.name+' uploaded.<a href="javascript:;" id="dele_image" onclick="del_image('+fileObj.filePath+','+fileObj.name+');">Upload Different Image</a><br>');

This is for uploadify script for previewing an image that is uploaded, it creates the link fine, but won't trigger the function "del_image" unless I delete the parameters in the onclick, which leads me to believe it is something to do with my quoting. Here is the function:

[Code]....

View 7 Replies


ADVERTISEMENT

Pass Parameters On B.onclick = Test Function?

May 30, 2010

I want to pass two parameters on button "b" click. how to pass parameters on b.onclick = test function?

function test(x, y){
alert(y);
}
var b = document.getElementById('b');

b.onclick = test; //how to pass x and y parameter?

View 5 Replies View Related

Launch Parameters - Change The Menu Item Link <a Href.../a> Dynamically?

Oct 1, 2009

I have a website with several pages. Each page having the same menu.I need one of this menu item's text to vary according to each of my customers, where the customer id will be passed from an external link at launch time.I also need to change the menu item link <a href.../a> dynamically.I'm planning to create a redir.html pacge for each client and within that page, I can insert a url with parameters to launch the main page.

View 1 Replies View Related

Cannot Pass Parameters Containing Hyphen(-) - Dot(.)

Jun 13, 2009

I am trying to pass dynamic String parameter to my javascript. The user enters sdome value and that is passed to the javascript as parameter. My problem is when user enters something of type cs204-1 or cs204.1 etc, the javascript does not run. On passsing simple parameters like cs204 or 111 etc, the javascript works fine. I need to pass any type of parameters to the javascript ( cs204-1 or cs204.1 etc) as I am making this for my college and the values to be entered by the user are of such type. My javascript code is : Code:

[Code]...

I tested the working of the javascript by using alert. It came for normal parameters but not for cs204-1 or cs204.1 types.

View 3 Replies View Related

Pass Parameters In The <script ..> Tag?

Sep 4, 2010

how to pass parameters in the <script ..> tag? for instance;

<script type="text/javascript" src="script.js?param1=val1¶m2=val2&etc">

in the javascript script.js, how would we read the params after the question mark? for example, google this; google shopping cart /v2_2/cart.js

View 7 Replies View Related

Cannot Pass Parameters Containing Hyphen / Dot

Jun 13, 2009

I am trying to pass dynamic String parameter to my javascript. The user enters sdome value and that is passed to the javascript as parameter. My problem is when user enters something of type cs204-1 or cs204.1 etc, the javascript does not run. On passing simple parameters like cs204 or 111 etc, the javascript works fine. I need to pass any type of parameters to the javascript ( cs204-1 or cs204.1 etc) as I am making this for my college and the values to be entered by the user are of such type.

My javascript code is :
function deleteQuestion(id){
alert(id);
questionId= eval("document.form1.deleteQ"+id+".value");
url='/DeleteQuestionServlet?questionId='+escape(questionId);
document.form1.action=url;
}
I tested the working of the javascript by using alert. It came for normal parameters but not for cs204-1 or cs204.1 types.

View 1 Replies View Related

How To Pass Parameters In URL For Javascript Refresh?

Jul 23, 2005

I have an easy question, likely, that has me in a headspin. I have an
include file to a frames based site that basically forces frames on
the end user if they visit the site and hit a non-frames created
page...

Simply, it is:

if (parent != self)
self.parent.location.replace("/");

However, now I would like to force an inner frame to populate based on
what frame someone was redirected from the include (above). So, if I
visit http://domain/frame/innerframe_3.html, then I want to redirect
to the above, but pass in /frame/innerframe_3.html to be included as a
URL parameter for an inner frame to be populated.

When I modify this link to:

if (parent != self)
self.parent.location.replace("/index.php?redir=" & location.href);

Then, the replaced location doesn't seem to recognize the ?redir=
portion of the new location.

Is there a different way to do this? I can't use a META tag because I
want the TARGET to be _TOP, basically.

View 3 Replies View Related

JQuery :: Pass Parameters To Selectors/has?

Oct 5, 2009

My button when click call cal function, inside cal function I need to find parent so I can access other element, but I donot know how to pass parameter to Selectors/has(for some reason $("div :button").each(function()... no work here)

Code as below:
function cal(event) {
if (!event) event = window.event;

[code]....

View 1 Replies View Related

Pass And Get Multiple Parameters In Another Page?

Sep 15, 2009

Hi all.Am new to this forum so cut me some slack if I don't articulate my problem with utmost clarity.My problem is that I have a javascript function such as:

function modReg(x,y)
{
<!--
var answer = confirm ("Do you really want to deregister user" +x+"?")
if (answer)
{
document.leo["id"].value=x;

[Code]...

Now, leo is a hidden form with the 2 fields namely "id and "two".Viewing source, I see that the parameters I need are well acquired by the function.In next page, I haven't been successful at retrieving the passed parameters.

View 9 Replies View Related

JQuery :: Pass Parameters Into The Plugin?

Dec 14, 2011

I have been checking out the following sitepoint tutorial on creating a plugin using Jquery http:[url]....I have some Questions about the selector and the parameters.Say for example, I wanted to pass parameters into the plugin:

Code:
(function($) {
// jQuery plugin definition[code].....

And conversely if the plugin takes no parameters $(selector).MyPlugin(); Firstly is my understanding correct and secondly what if the plugin doesn't require a selector? What if it doesn't need to do anything to a given DOM element? would it be something like:

$().MyPlugin(someparameters)

View 2 Replies View Related

Way To Pass Parameters Via URL To A HTML Form

Feb 22, 2010

I am passing parameters via URL to my HTML form. The hardcoded hidden values work. Does anyone know how I can modify this so that the parameters can also write to the hidden values?code...

View 3 Replies View Related

Can't Get Object Constructor To Pass Other Objects As Parameters

Jun 12, 2011

I have a code set up something like this:

[Code]....

The problem is I keep getting an error along the lines of: TypeError: Result of expression 'house' [[object Object]] is not a constructor. It seemed to work when I wasn't passing the other objects as parameters in the constructor. I just created and assigned them later. As in:

[Code]...

View 4 Replies View Related

Jquery :: Function Parameters - Pass Var HoverText To The Hover Out

Jun 9, 2010

I am trying to remove a title attribute for a link on hover and then add it back on mouse out. I would like to pass var hoverText to the hover out...

[Code]...

View 3 Replies View Related

Onclick Parameters

Jul 20, 2005

I have an onclick function that pops a new window (nothing fancy) the problem is that whenever I want to return to the page where I popped the new window from I find that it is reloaded and has taken me to the fist line of the page. What parameter (or anything else for that matter) can I add in order to pop up a new window and still be in the same place when I return to the previous page?

View 2 Replies View Related

JQuery :: Pass A HREF To An IMG SRC In A Div?

May 6, 2011

I have a page with dozens of anchored links. When you click on the link, the appropriate div becomes visible. Each div contains an image. Because each DIV has a large image associated with it, it takes entirely too long for the page to load. I would like to set the IMG SRC inside of the div when they click. Each anchor href is the exact same name as the image to be loaded - so #dali would contain dali.jpg. How dow I pass the HREF minus the hash mark (#)? This is as far as I've gotten:

$("a").click(function() {
var whichDiv = $(this).attr("href");
$(whichDiv).attr("src", "images/art/" + whichDiv + ".jpg");
});

[Code]....

View 4 Replies View Related

How To Attach OnClick Function With Parameters

Aug 10, 2009

I want to attach a js function to be called when a img is clicked and I'm changing the functions of onclick based on the image. I used setattribute but it doesn't works in IE. So I decided to use
object.onclick = somefunction;
but my functions are based on parameters and the whole function runs based on the passed parameter.

So I tried:
like this object.onclick = "somefunction('"+mat+"')";
but doesn't work. I need a code which can attach the function on click event for both firefox and IE.

View 1 Replies View Related

Input Box To Pass Data To Href= Url?

Oct 21, 2010

I have an HTML link (<a href='somepage.php'>......)

When someone clicks this, I would like to have a Javascript input box popup to accept some data, then have it pass the data in the url.

The ending result would be a jump to page: somepage.php?data=my%20input

I'm not even sure how to word a google search for this.

View 1 Replies View Related

Pass Id From Href Link & Toggle On Off?

Oct 28, 2010

i have a little function that uses a checkbox to turn off or on a map layer

function toggleGeoXML(id, checked) {
if (checked) {
var geoXml = new GGeoXml(layers[id].url);

[code]....

View 5 Replies View Related

JQuery :: Pass Id's From An <a Href> Tag Into Galleria Slideshow?

Jul 25, 2011

My issue seems basic enough but i can't seem to get things working.

I have a list of links within a div as follows:

[Code]...

View 2 Replies View Related

Location.href :: Pass Values From One Page To Another?

Feb 25, 2010

every time i try something it doesn't work for me :( god why is this javascript so hard to make it work... anyway, i just followed the guidelines to pass values from one page to another using ? and it simply, like always, DOES NOT work .

<HEAD>
...
...

<script type="text/javascript">[code].....

View 7 Replies View Related

Can I Pass The Name Of A Javascript Function To A Page Opened With An Href

May 26, 2007

I'm not sure whether or not this is possible, but I want to have control over the Javascript function that is called when a target web page is opened (ie as the onload function in its <body> tag). In other words, the calling page will have several <a href ...> tags referencing the same page, each specifying a different onload function. Is it possible to effectively pass a parameter in this way? I have not been able to find any solution to this.

View 2 Replies View Related

JQuery :: Bind With Parameters - Replace Inline OnClick For Server Side

Jul 2, 2009

Is there a way to do this for a while. Say I have a dynamic page that generates some td elements. The syntax here is freemarker but you can easily envision your favorite serverside text generating language instead.

<table id="records">
<thead><th>Name</th></thead>
<tbody>
[#list records as record]
<tr>
<td class="trigger" id="trigger_${record.ID}" onclick="showDetails
(${record.ID})">${record.name}</td>
</tr>
[/#list]
</tbody>
</table>
<script type="text/javascript">
function showDetails(recordID) {
// normally an ajax post but you get the idea
window.location = '/record?recordID=' + recordID
}
</script>

Now I want to get that onclick out of there and bind it using jquery, but I haven't been able to figure out if there is a way to get the parameter there. Apart from putting it in some attribute and looking at it. Is there a cleaner way?

<script type="text/javascript">
$(document).ready(function() {
$('#records td.trigger').click(function() {
window.location = '/record?recordID=' + ??? how do i get that
});
});
</script>

I know I could look at the elements attributes, something like this.attr("id").substring().etc().etc() .. but sometimes there are many parameters to the javascript fn to generate the post and that approach doesn't seem to viable. and there isn't really a standard attribute to use that makes sense for that anyway.

View 5 Replies View Related

JQuery :: Onclick With Different Href Url For Lightbox?

Aug 22, 2010

I am doing a lightbox effect onclick a image.Its easy if I just use this code:

<a href="images/image-0.jpg" class="lightbox" title="Cape Breton Island"><img src="images/thumb-0.jpg" width="100" height="40" alt="" /></a>
<script>
$(document).ready(function(){

[Code].....

View 2 Replies View Related

Call Onclick And A Href In Same Time?

Jul 11, 2009

I have this html [code]...

the inc_down function is part of a AJAX implementation. I want that this function be be executed when i click the div and in the same time the a href to work. In the code above the onclick does not work, only a href works. I have searched the net and the code above is the best i've found but it does not work.

View 14 Replies View Related

Location.href Within OnClick Event

Jul 20, 2006

I am creating a send to a friend link on my site. The link will open a pop up window, which contains a form.

I have a function that opens the centered pop up window, and it is called like so (the function declaration resides in an external script):

Code:
onClick="newWindow('http://www.mysite.com/send.php','',âÆ',ò“','')"
I now need to append the current page's URL to the end of the URL ike so:

onClick="newWindow('http://www.mysite.com/send.php?page=xxx','',âÆ',ò“','')"
This is sso that I can then use PHP in the pop up toget the variable from the query string.

I know that I can use location.href to get the current page url, but am not sure how I would include it in the onClick.

I have tried the following:

onClick="newWindow('http://www.mysite.com/send.php?page=location.href','',âÆ',ò“','')"
but that doenst work...

Has anybody got any ideas?

View 3 Replies View Related

Popup Window For A Href Not Onclick

Aug 4, 2009

how I can have a popup window appear centred with scrollbars? The width and height must be changed for each popup. I need the popup window link to be placed in a href not as onclick. My client will be placing popup window link into their website via Adobe Contribute, so that is why I am asking for the whole thing not to be onclick.

View 3 Replies View Related







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