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


ADVERTISEMENT

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 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

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

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

Make An Onclick Event Change The Document.onclick ?

Sep 4, 2010

I want to make it so that when I click on something, it changes what document.onclick does.

This is a simplified version of what I'm trying to do:

Code:
<div id="clickme" onclick="document.onclick = function(){ alert ('This should not be alerted on the first click'); }">Click here</div>

However, as you'll notice, the alert box shows up on the first click as well. The only way I have been able to get around this behaviour is to have the first onclick execute a timer that will then set the document.onclick after 1ms, however this seems very messy to me.

View 1 Replies View Related

Function/parameters

Jul 23, 2005

I have a problem with the following function:

I would like to define the hight/length of the window which I open when
I call the function.

The problem is that the window opens but not with the size I defined
when calling the function. Code:

View 5 Replies View Related

Reading Parameters Using Js, From A Url

Jul 23, 2005

Can someone give me some pointers on how I can read one or more
arguements from a url, using js?

Why? I'm working on a LAMP based project and when a user successfully
registers, the header redirects to the login screen - I'd like to check
for the value of register, if read from:

http://www.mydomain.com/index.html?register=success

A pointer/hint as opposed to a solution should be sufficient because I'm
doing pretty well learning javascript.

View 1 Replies View Related

Getting Parameters From The Get Method

Oct 6, 2005

I am pretty rusty with javascript and I am trying to make a webpage
that will basically act as a wrapper from one webpage to another. What
I mean by this is that I will hit this page like:
webpage.htm?Param1=... and I will take the passed params and post them
to another page. I have the post part working, but I was just
wondering how I can use just Javascript and read those values passed to
this webpage. Is this even possible?

View 3 Replies View Related

Extracting Parameters

Jun 2, 2007

I found this little script for extracting parameters from a url but wondered
what the shortest and most efficient way to do it would be, like the
following or via regexp?

function getParameter(paramName) {
var currentUrl = window.location.search
var strBegin = currentUrl.indexOf(paramName) + (paramName.length+1)
var strEnd = currentUrl.indexOf("&",strBegin)

if (strEnd==-1)
strEnd = currentUrl.length
return currentUrl.substring(strBegin,strEnd)
}

Any shorter way?

View 1 Replies View Related

JQuery :: Get And Set URL Parameters?

Apr 21, 2011

I need to know a way to get/set URL parameters with jQuery.

Here is the flow between pages im having:

What i want to have is:

Each page offers a choice to user and must add the choice in url. Actually im using forms with submit buttons to do it but i dont know how to keep parameters from previous page in the current page.

View 6 Replies View Related

JQuery :: How To Get The Url Parameters

Jun 7, 2009

I need to get which all are the parameter in the current url[URL]...Since my parameters changes every time, I need to get the parameters (not values of parameters)

[Code]...

View 1 Replies View Related

JQuery :: Get Parameters From URL?

Oct 17, 2009

It's possible to get values from URL with jQuery like PHP? For example suppose you have this URL:form.html?s=ok&val=rperezm. In PHP is simple:

[Code]..

View 3 Replies View Related

Read These Parameters From URL?

Jan 20, 2010

I want to pass parameters thru URL. I know how to pass. I am finding problem in reading the parameters. here is the [URL]. how to to read these parameters from URL using java script?

View 3 Replies View Related

Request A Url With Parameters?

Feb 1, 2011

i m trying to implement captcha in my site.i m using recaptcha. To check the captcha i need to request url like: [URL] and then i need to check response from url if it is true or false i dont know how to request response from url

View 2 Replies View Related

Function Parameters, Within Function Parameters?

Jun 6, 2011

I am making a function that executes code as AJAX readyState's are returned. If readyState = 3 then I running code through eval but I want to be able to run functions with parameters, within the parameter that is evetually executed by the eval

Heres abit of pseudo code of what I am talking about

function receiveRequest(whileLoading, whenDone) {
// AJAX stuff... blah... blah... blah...
if request is being processed:
eval(whileLoading)
if request is done:
eval(whenDone)

[Code]...

I haven't used Javascript in agggeeesss and I can barely remember anything anymore - PHP <3

View 2 Replies View Related

Don't Show Parameters In URL

Apr 26, 2011

In the javaScript function below, is there anything I can add to the window.open so that the parameters passed in the URL do NOT show in the window that is opened? It is okay if the script path shows, I just need to hide the parameters. If that is not possible, can I have it show no URL show at all?

function OpenTest2(ID,course,test)
{
var agree=confirm("Are you sure you want to Launch this test?");
if (agree){
path = "testing_center/frameset.cfm?TestID=" + ID + "&UserID=<CFOUTPUT>#session.userID#</CFOUTPUT>";
window.open(path ,'popuppage','scrollbars=yes,fullscreen=yes');
[Code]...

View 4 Replies View Related

AddEventListener Parameters

Jul 12, 2007

Is there a way to send parameters to the function being added to an event with addEventListener. I.E. say you have this function

Code:
function someFcn(i){
alert(i);
}
and I add it to an object.

Code:
someElement.addEventListener('focus', someFcn, false);
Is there a way to send a parameter to someFcn.
For Example I have tried this but it failed

Code:
var someString = 'Hello World'
someElement.addEventListener('focus', someFcn(someString), false);

View 3 Replies View Related

Parsing Url Parameters

Dec 4, 2002

I have a url with parameters like the following:

http://test.com/mycode.html?xyz&myvar=value2

I need to endup with the following available to JS

base_file = mycode.html
parameter1 = xyz
parameter2 = value2 or myvar = value 2

What is the easiest way to parse the query string out of the url? When I use self.location I get everything.

View 8 Replies View Related

Multiple Parameters Through GET?

Dec 29, 2010

Ok I am pretty sure Javascript is the only way to do this I need to pass more than one parameter from a form to a url For example:

I need this output

Code:
http://mywebsite.com/index.php?price_min=10&price_max=20&sort=featured
I would have no problem if I only needed
Code:
http://mywebsite.com/index.php?price=10
Code:
<form method="get" action="http://mywebsite.com/index.php"

[Code]...

View 2 Replies View Related

Using URL Parameters In HTML

Feb 11, 2011

I have a query string which contains various elements...

&Var1=10.00
&Var2=5.00
etc.,

I'd like to reference these values within my html code (multiple times). I've tried embedding <script> javascript tags into the html, but this doesn't work. I.e. <script>var MyVar1= getElementById('Var1').value;document.write MyVar1;</script> I can obviously refer to the element once by putting within an input form element, but I want to refer to the variable mutiple times.

View 6 Replies View Related

Passing Parameters From JSP To JavaScript

Jul 23, 2005

I have a JavaScript function that receives an Array with words. This
Array can be gotten from a query to a DB using JSP.

The JavaScript function is executed when onFocus event occurs:
<input type='text' onFocus='myFunction(this.event, myArray);' />

myArray is declared as:

<script>
var myArray = new Array('j'habite', 'tu habites', 'il habite');
</script>

I want to tell javascript:
var myArray = myJSPArray;
Where myJSPArray is declared some where in the JSP document.

View 2 Replies View Related

Change Applet Parameters

Jul 23, 2005

I have an applet and want to change it's parameters with multiple links in
my page.

this is my code:

<applet code="GIS.class">
<param id="moneyID" name="money" value="100">
<param id="vicimsID" name="vicims" value="2">
<param id="countryID" name="country" value="UK">
</applet>

How to create a function that will be called from some links and change the
values according to the user's values (from a textbox or anything else).

View 3 Replies View Related

Changing Parameters In Javascript

Mar 29, 2006

This should be simple, but can I change parameters like the url coming
in:

www.testpage.com?test1=a

<script>
document.setParam("test1", "b");

</script>

something like that? I want the parameter to change based on the code..

View 6 Replies View Related

Referencing Parameters In JS, POST Vs. GET

Jul 20, 2005

I would like to reference the "name=value" parameters sent to my page
(submit'ted from a previous page with a <form>.) in my javascript.

I can do it if my second form is called with a "get" using the
window.location.search property, etc.

I don't know where these parameters are if my second page is called with a
"post"...

View 1 Replies View Related

Parameters Not Entering Function?

Jul 20, 2005

I keep getting a runtime error stating that this
document.adddealer.dealertoadd.value = dealer; is null or not an
object. I've rewritten the Function everyway I could think of, and
couldn't find any thread examples of my problem.

Here is my Function;

<Script language="JavaScript">
<!--//hide
function AddDealer(dealer) {
document.adddealer.dealertoadd.value = dealer;
document.adddealer.submit();

}
//-->
</script>

This calls the Function;

<input type="button" value="Make This My Dealer"
name="button">

When the code breaks and I bring up Microsoft Debugger it shows a
value in the parameter.

View 6 Replies View Related







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