I know in different languages (VB.Net,C++,C#) how to pass an argument to function in this code:
<html>
<head>
<script language="Javascript">
<!-- hide
function openNewWindow() {
popupWin = window.open('[URL]',
'open_window',
'menubar, toolbar, location, directories, status, scrollbars, resizable, dependent, width=640, height=480, left=0, top=0')
} done hiding -->
</script></head><body>
<a href="javascript:openNewWindow();">return to front page</a>
</body></html>
I need to add several links in my page, so I need to pass indexes from links to main function, so I can open images in specific folder with indexes filenames. For example in vb
Subname("text_to_pass_to_SubName")
Public Sub SubName(ByVal function_text as string)
End Sub
I have a function which can be called with an unlimited number of arguments.
I want to call another function with exactly the same arguments. I know I can get the arguments in the arguments object, and as such also in an array, but how do you pass the elements of an array to another function as parameters?
I would like to display few calendar fields on the same page with different days disabled. I guess that the easiest way to do that would be to let thenoWeekendsOrHolidaysfunction take care of it but in order to do that I need to pass some values to it. How can I do that?
This example is much simplified as the original script.VBScript is making a value, passes this to Javascript, which puts that value into a div tag.Now, as you see in the VBScript, the value contains a call to a javascript function. It shows perfectly in HTML, but the call can't be made when clicking the link.Is it possible in VBscript to write dynamic hardcoded javascipt function that pass arguments?
I'm use prototype quite a lot for ajax calls, but have always used inline onclicks. I'm trying to be less obtrusive by creating event handlers/listeners.I used to do this with the aid of pHp to place arguments into the function (usually via 'while loop'):
I use addEventListener and I cannot (or at least don't know how) pass arguments to the function.
Let's say we have a function: function warning(arg1, arg2) {alert('Argument 1: ' + arg1 + ', Argument2: ' + arg2 + '.');}
It's possible to have: onclick="warning('my argument 1', 'my argument 1');" as an html attribut.
But I think it's not posible to do it like this (still the same function): el.addEventListener("click", warning('my argument 1', 'my argument 1'), false);
I haven't come across an exampe that would enable me to pass data to my event handler.For example, if I click a button I want it to pass the value of an adjacent text input to my handler.
I'm scripting Adobe InDesign via JS. (don't be frightened this post is purely about JS problem)
I've created custom 'Classes' for custom InDesign objects.They all inherit common methods from generic 'Item' class. Now the problem is that most of these methods need acces to the arguments of the child's constructor.
I have a main page that opens a pop up window when the user clicks a link. The pop up window is a menu and when the user clicks the item, it populates a form input element on the 'parent' window.
My question is: this new populated form element is the value that I use to change a style.
onchange does not watch this form element because of getelementbyid, so it doesn't trigger the function needed to change the style. onchange works fine if I just manually input a value into the text box.
Any other way to fire the function off when the user picks their selection from the pop-up window? I was thinking I could use window.opener.function()? But how do I pass the form from the parent window? From the pop up window, I don't use this.form, what do I use?something like window.opener.form[0] ?
What I want is a loop that will call the same function until it reaches a certain number (let's say 10). Then I want the function to take the parameter passed (the number) and use it in the function where ever you see a 1 below. Basically I want it to run on each element of the pub_name array and from the info gathered define a variable based on the number (example: display_pub_name_*). I have run some tests .....
I have an external javascript file with certain attributes defined to open a file in new window, which I use for viewing maps. However I need to define different attributes for the height and width, as I want users to open video clips in smaller windows. What do I need to do? Code:
I'm having problems when passing and element from HTML to a script. I have several rows for a person addresses and when one of those fields change I need to update the value of a flag (that is a hidden element).
Is there a way to pass arguments to the callback function used inside an addEventListener? I see that I can only list the name of the callback function. For eg, I use this:
var boldLink=document.getElementById('cmtbold'); boldLink.addEventListener("click", rBold, true);
I need the id of boldLink to be accessible from inside the function rBold()
Sorry, bad title. Anyway, is there a way to pass the arguments to an object instantiated via a constructor using the arguments object and have it expanded, so to speak, so that it doesn't appear as a single argument? I'm sorry, this explanation is just atrocious, but I can't think of exactly how to word it. Maybe an example...
Take for instance Function.apply. It takes 1-2 arguments, the first being the object to use as the context, and the second being either an array or an instance of the arguments object which are to be the arguments for the function. I want to do something similar but I want to also basically use the new operator so that I get back an object.
Here's a snippet of some of my code, maybe this will help:
The above code would have to be embedded into the PHP file.
how can we go about doing that unobtrusively? Ie by not putting the code into the PHP files how can a different argument be passed to that function depending on what page is loaded?
This is related to the pop-up window. Below is the function related to pop-up window. function openPopUpDetailsMultiple(seqNum ,controllername ) { if (!popUpDetails||popUpDetails.closed) { popUpDetails=window.open("GetSCEventAddData?schandle=<!.schandle>&objID=<!.objID>&seqnum="+seqNum+"&controllername="+controllername+,"popUpDetails","toolbar=1,location=0,scrollbars=1,width=600,height=300,resizable=1,left=200,top=200"); }else{ popUpDetails.focus(); popUpDetails.location="GetSCEventAddData?schandle=<!.schandle>&objID=<!.objID>&seqnum=" + seqNum; } }
The problem I'm facing now is in this piece of code: ><a href=javascript:openPopUpDetailsMultiple('"+ scEv[i].sceSeq+"''"+ scEv[i].sceCntr +"')><img src=images/NsaMoreDetails.gif border=0 height=16 width=16 align=middle alt='View more details'>More details</a></td></tr></table></td></tr></table>"); I do not know how to send these (scEv[i].sceSeq,scEv[i].sceCntr) arguments. What might be the delimiter for these arguments.
I have 10 web links on my index but at the top my page is there one <input type="text" name="myurls"> So I want to create an effect like the following:
When some user press to the "click add" link the url link http://www.yahoo.com is passed on <input type="text" name="myurls"> and if the same user click on other link the present link disappears and the new is writing.
I want to call java function in javascript.In which we pass one parameter to function and its returns String value which I want to display in alert message.
I am trying to minimize the amount of script that I use on my website. I have sections of each page; each section has the same basic layout. The divs and images that I want to make appear and disappear all have nearly identical ids, the only difference is the number at the end of the id.Is there a way to get one script to automatically detect which id number has been clicked and then show all elements with the same number at the end of the id? I would also like it to hide the elements in the hide function below (basically they are the elements that do not share the same id number).I currently have everything working the way I want it to using multiple functions like the one below but I woul