|
how to call server side function by javascript
|
|
|
|
|
|
It's pretty easy with jQuery. http://api.jquery.com/jQuery.ajax/[^] Create a webservice and then call it with jquery.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I build JavaScript.I create Button and Throw value to textbox when Click the button.when I use with iOS 5,It run fast,but when i use with iOS 6,It run very slow.could have an idea about this.Thank in advanced!
|
|
|
|
|
Hi,
I use ASP.NET.
This is structure I have:
Master page -> Content page -> User control -> Telerik grid with its context menu, hidden field.
This means: Master page contains content page, content page contains user control, user control contains Telerik grid with its context menu and hidden field.
I open popup window by clicking option in Telerik grid's context menu. After I choose some option in combo box in that popup window I press OK and close it. But I don't know how to reference opener that should be user control with Telerik grid and hidden field. I want to set hidden field to some value.
This is JavaScript code I use:
<script language="javascript" type="text/javascript">
function ReturnValue() {
var choice = document.getElementById("DropDownList1").value;
if ((window.opener != null) && (!window.opener.closed)) {
window.opener.document.getElementById("HiddenField1").value = choice;
}
window.close();
}
</script>
But, it fails on this line because opener is master page:
window.opener.document.getElementById("HiddenField1").value = choice;
So, how can I make it work?
Thank you in advance.
|
|
|
|
|
If you want to reference a control that is in a usercontrol from master.
look at this example:
window.opener.document.getElementById('<%=ContentPlaceHolder1.FindControl("usercontrolID").FindControl("hiddenfield").ClientID %>').value = choice;
I could be wrong, but it wont hurt if you try it out.
|
|
|
|
|
View the source of the page and you'll see how it is getting named. Or, as a previous post mentioned you can figure it out on the server side.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Represents an open window in the browser.
Members Table
The following table lists the members exposed by the window object. Click a tab on the left to choose the type of member you want to view.
Attributes/Properties
Show:
Attributes/Properties
Collections
Events
Methods
Objects
Property Description
closed Retrieves whether the referenced window is closed.
defaultStatus Sets or retrieves the default message displayed in the status bar at the bottom of the window.
dialogArguments Retrieves the variable or array of variables passed into the modal dialog window.
dialogHeight Sets or retrieves the height of the modal dialog window.
dialogLeft Sets or retrieves the left coordinate of the modal dialog window.
dialogTop Sets or retrieves the top coordinate of the modal dialog window.
dialogWidth Sets or retrieves the width of the modal dialog window.
frameElement Retrieves the frame or iframe object that is hosting the window in the parent document.
length Sets or retrieves the number of objects in a collection.
name Sets or retrieves a value that indicates the window name.
offscreenBuffering Sets or retrieves whether objects are drawn offscreen before being made visible to the user.
opener Sets or retrieves a reference to the window that created the current window.
parent Retrieves the parent of the window in the object hierarchy.
returnValue Sets or retrieves the value returned from the modal dialog window.
screenLeft Retrieves the x-coordinate of the upper left-hand corner of the browser's client area, relative to the upper left-hand corner of the screen.
screenTop Retrieves the y-coordinate of the top corner of the browser's client area, relative to the top corner of the screen.
self Retrieves a reference to the current window or frame.
status Sets or retrieves the message in the status bar at the bottom of the window.
top Retrieves the topmost ancestor window.
Attributes/Properties
Collections
Collection Description
frames Retrieves a collection of all window objects defined by the given document or defined by the document associated with the given window.
Events
Event Description
onactivate Fires when the object is set as the active element.
onafterprint Fires on the object immediately after its associated document prints or previews for printing.
onbeforedeactivate Fires immediately before the activeElement is changed from the current object to another object in the parent document.
onbeforeprint Fires on the object before its associated document prints or previews for printing.
onbeforeunload Fires prior to a page being unloaded.
onblur Fires when the object loses the input focus.
oncontrolselect Fires when the user is about to make a control selection of the object.
ondeactivate Fires when the activeElement is changed from the current object to another object in the parent document.
onerror Fires when an error occurs during object loading.
onfocus Fires when the object receives focus.
onhelp Fires when the user presses the F1 key while the browser is the active window.
onload Fires immediately after the browser loads the object.
onmove Fires when the object moves.
onmoveend Fires when the object stops moving.
onmovestart Fires when the object starts to move.
onresize Fires when the size of the object is about to change.
onresizeend Fires when the user finishes changing the dimensions of the object in a control selection.
onresizestart Fires when the user begins to change the dimensions of the object in a control selection.
onscroll Fires when the user repositions the scroll box in the scroll bar on the object.
onunload Fires immediately before the object is unloaded.
Methods
Method Description
alert Displays a dialog box containing an application-defined message.
attachEvent Binds the specified function to an event, so that the function gets called whenever the event fires on the object.
blur Causes the element to lose focus and fires the onblur event.
clearInterval Cancels the interval previously started using the setInterval method.
clearTimeout Cancels a time-out that was set with the setTimeout method.
close Closes the current browser window or HTML Application (HTA).
confirm Displays a confirmation dialog box that contains an optional message as well as OK and Cancel buttons.
createPopup Creates a popup window.
detachEvent Unbinds the specified function from the event, so that the function stops receiving notifications when the event fires.
execScript Executes the specified script in the provided language.
focus Causes the element to receive the focus and executes the code specified by the onfocus event.
moveBy Moves the screen position of the window by the specified x and y offset values.
moveTo Moves the screen position of the upper-left corner of the window to the specified x and y position.
navigate Loads the specified URL to the current window.
open Opens a new window and loads the document specified by a given URL.
print Prints the document associated with the window.
prompt Displays a dialog box that prompts the user with a message and an input field.
resizeBy Changes the current size of the window by the specified x- and y-offset.
resizeTo Sets the size of the window to the specified width and height values.
scroll Causes the window to scroll to the specified x- and y-offset at the upper-left corner of the window.
scrollBy Causes the window to scroll relative to the current scrolled position by the specified x- and y-pixel offset.
scrollTo Scrolls the window to the specified x- and y-offset.
setActive Sets the object as active without setting focus to the object.
setInterval Evaluates an expression each time a specified number of milliseconds has elapsed.
setTimeout Evaluates an expression after a specified number of milliseconds has elapsed.
showHelp Displays a Help file. This method can be used with Microsoft HTML Help.
showModalDialog Creates a modal dialog box that displays the specified HTML document.
showModelessDialog Creates a modeless dialog box that displays the specified HTML document.
Objects
Object Description
clientInformation Contains information about the Web browser.
clipboardData Provides access to predefined clipboard formats for use in editing operations.
document Represents the HTML document in a given browser window.
event Represents the state of an event, such as the element in which the event occurred, the state of the keyboard keys, the location of the mouse, and the state of the mouse buttons.
external Allows access to an additional object model provided by host applications of the Microsoft® Internet Explorer browser components.
history Contains information about the URLs visited by the client.
location Contains information about the current URL.
navigator Contains information about the Web browser.
screen Contains information about the client's screen and rendering capabilities.
Remarks
You can use the window object to retrieve information about the state of the window. You also can use this object to gain access to the document in the window, to the events that occur in the window, and to features of the browser that affect the window.
Typically, the browser creates one window object when it opens an HTML document. However, if a document defines one or more frames (that is, contains one or more frame or iframe tags), the browser creates one window object for the original document and one additional window object for each frame. These additional objects are child windows of the original window and can be affected by actions that occur in the original. For example, closing the original window causes all child windows to close. You can also create new windows (and corresponding window objects) using methods such as open, showModalDialog, and showModelessDialog.
You can apply any window property, method, or collection to any variable or expression that evaluates to a window object, regardless of how that window was created. Additionally, you can access all window properties, methods, and collections in the current window by using the property, method, or collection name directly?that is, without prefixing it with an expression that evaluates to the current window object. However, to help make more readable code and to avoid potential ambiguities, many authors use the window keyword when accessing window properties, methods, and collections for the current window. This keyword always refers to the current window.
Note : The window's properties, methods, and collection names are reserved keywords and cannot be used as the names of variables or routines.
The following table lists pertinent information for some of the properties of the window object.
Property Method Description
opener open The opener property is available only from a page opened using the window.open method.
parent, top None The parent and top properties are available for a window opened inside a frame or iframe. The two properties return the topmost parent and immediate parent, respectively.
parent, top open The parent and top properties are available for a window opened via the open method or as a dialog and returns the current window.
length None Regardless of how the window is opened, the length property returns the number of frames in a window.
dialogArguments, dialogHeight, dialogLeft, dialogTop, dialogWidth, returnValue showModalDialog and showModelessDialog These properties are available only for windows created using the two methods listed?showModalDialog and showModelessDialog
This object is available in script as of Internet Explorer 3.0.
Examples
This example displays an alert for the current window.
alert("A simple message.")
This example checks whether the current window contains child windows and, if it does, displays the names of those child windows.
if ( window.frames != null ) {
for ( i = 0; i< window.frames.length; i++ )
window.alert ("Child window " +i+ " is named "+window.frames(i).name);
}
This example shows a simple event handler function for the window's onload event. In the absence of a "window" element, the body element hosts the following window object events: onblur, onbeforeunload, onfocus, onload, and onunload.
<BODY onload="window.status='Page is loaded!'">
|
|
|
|
|
I have an .aspx from that is serving as a popup and populating textboxes on another form through the javascript below. I'm needing a way to on either screen to avoid a " " from appearing for Nulls. Any ideas? Maybe "IF val1 == " "... "" Else.... "(?) Thanks!:
<script language="javascript">
function GetRowValue(val1, val2, val3, val4, val5, val6) {
window.opener.document.getElementById("txtEndUserLastName").value = val1;
window.opener.document.getElementById("txtEndUserFirstName").value = val2;
window.opener.document.getElementById("txtEndUserMiddleName").value = val3;
window.opener.document.getElementById("txtUserLanId").value = val4;
window.opener.document.getElementById("txtEndUserLocation").value = val5;
window.opener.document.getElementById("txtEmail").value = val6;
window.close();
}
</script>
<script runat="server">
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles Gridview1.RowDataBound
If (e.Row.RowType = DataControlRowType.DataRow) Then
DirectCast(e.Row.FindControl("btnSelect"), Button).Attributes.Add _
("onclick", "javascript:GetRowValue('" & e.Row.Cells(1).Text & "','" & e.Row.Cells(2).Text & "','" & e.Row.Cells(3).Text & "','" & e.Row.Cells(4).Text & "','" & e.Row.Cells(5).Text & "','" & e.Row.Cells(6).Text & "')")
End If
End Sub
</script>
modified 11-Feb-13 10:46am.
|
|
|
|
|
was thinking something like this would work but it may need some modification to work (?):
window.opener.document.getElementById("txtEndUserLastName").value = (val1 == " " ? "" : val1);
|
|
|
|
|
I want create Appointment/Event from my website to yahoo calendar using JavaScript. Kindly let me know which API/REST service use to create Appointment
|
|
|
|
|
I would first check with yahoo. They have a developer site.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
The code below works fine on IE and FF but not on Google Chrome.
Please can someone help me to find out the mistake?.
Flex Code:
Public function init():void
{
ExternalInterface.addCallback("getCloseConfirmMessage", closeConfirmMessage);
ExternalInterface.call("setUpBeforeUnload",FlexGlobals.topLevelApplication.id);
}
Public function closeConfirmMessage():void
{
//DB Updation code
}
Java Script :
<script language="javascript" type="text/javascript">
var fxControl;
function confirmClose()
{
alert("Please click OK to end the session"); fxControl.getCloseConfirmMessage();
};
function setUpBeforeUnload( appName )
{
fxControl = document[ appName ] || window[ appName ];
window.onbeforeunload = confirmClose;
};
</script>
|
|
|
|
|
Have you tried using chrome's developer tools? My guess is a chrome setting is blocking it from loading.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Are you serving this through a web server or from a local file? Chrome (and Chromium) has a security system in place that prohibits local files from running scripts. I think you might have been bitten by that one.
R3J5cGhvbnMgYXJlIGF3ZXNvbWUuIEdyeXBob25zIHJ1bGUh
|
|
|
|
|
I have this simple script
function displayMessage(evt) {
alert(evt.source.toString());
}
if (window.addEventListener) {
window.addEventListener("message", displayMessage, false);
}else {
window.attachEvent("onmessage", displayMessage);
}
I am using curl to send this message by
curl -X POST -d "payload" http://localhost:50334
But I never received the message. I am using IE9. What I am doing wrong?
Your help will be very much appreciated.
|
|
|
|
|
Hello,
I don't think you can do this to send a message to browser.
Regards,
Prasad P. Khandekar
Knowledge exists, man only discovers it.
|
|
|
|
|
Hello, I am attempting to create a spell checker using javascript. I am new but I have experience.
I am not using a dictionary, instead I want to use an array to hold 6 or 7 words that are spelled correctly.
The user will enter one of the words in a text box and hit a button (labeled spell check of course).
I am assuming I am going to want to use an on-click event for the button that will compare the word submitted in the textbox to one of the 6 or 7 words in the array.
I have the html and css done. I have also created the array.
I am not sure how I would compare the string that is inputted by the user to my wordlist array. I need help please.
This should (in theory) create a spell checker that will check the words in my array.
var wordlist = new Array(6);
wordlist[0] = "dog";
wordlist[1] = "potato";
wordlist[2] = "napkin";
wordlist[3] = "knife";
wordlist[4] = "pumpkin";
wordlist[5] = "probably";
wordlist[6] = "wednesday";
|
|
|
|
|
use indexOf
wordlist = ['dog', 'potato', 'napkin', 'knife', 'pumpkin', 'probably', 'wednesday']
wordlist.indexOf('dog')
0
wordlist.indexOf('potato')
1
wordlist.indexOf('potatou')
-1
|
|
|
|
|
i am a 4th year student doing my final project on java i could request you to write me an abstract and a code for the following-
'A SPELL CHECKER THAT MAKES USE OF A HASH TABL
it should not in corparate with the dictonary.
thanks in advance!
|
|
|
|
|
- This is the Javascript forum; please investigate the difference.
- We do not do your homework or college assignments. This site is here to help with specific questions.
- If you have problems with your knowledge of Java then try The Java Tutorials[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
The temptation to do his homework for him is realy strong though. Only I'd deliver code that plays hangman instead of a dictionary. And in C#. ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Excellent! Another unemployable graduate. My job is safe for another year.
|
|
|
|
|
Hey,guys,I make a useful app to debug webpage on iOS.It's free,always be free!And no ADs!But I don't know how to make people who works on mobile web app to know about it.In order to make it better I need to know what they want. Here is the app.
MIHTool
About MIHTool.http://www.iunbug.com/mihtool[^]
View in App Store.https://itunes.apple.com/us/app/mihtool/id584739126?ls=1&mt=8[^]
MIHTool Google group.https://groups.google.com/group/mihtool[^]
MIHTool helps Front-End Engineers to debug and optimizing their webpages on iPad and iPhone.
Right now:
For iPad
1.With HTML editor:view webpage source code with syntax highlighting and formatting;editing source code or creare a new webpage and preview the result.
2.Show WebKit Debug Borders(Compositing Render Layers).
3.Show Webkit Repaint Counter(Paint Rects).
4.More development tools(Firebug,YSlow,JS Console,WhatFont,PageSpeed,GTmetrix,W3C Markup Validation Service…).
5.User agent switcher.
6.Evaluating JavaScript in the address bar.
7.Full screen mode(Shake Device To Toggle Full Screen Mode).
8.Disable cache.
9.Clear History,clear cache,clear cookies, clear localstorage.
For iPhone
1.Show WebKit Debug Borders(Compositing Render Layers).
2.Show Webkit Repaint Counter(Paint Rects).
3.Full screen mode(Shake Device To Toggle Full Screen Mode).
N/A
|
|
|
|
|
Hi all,
I have scenario where a string can contain '$' only at the start, I was able to create a regular expression for this validation, but now another scenario is the same string can be repeated by a ',' delimiter. Now what happens is since I don't allow the '$' in the string except for the first position, when I repeat the same string after ',' starting with '$' the validation fails.
Is there anyway in which we can restrict a character uptil some delimiter and then again allow it?
Any pointers would be appreciated.
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|