|
Explanation is not enough in all situations. So Please give some string examples..
Thank you..
Vinod Kumar B C
Software Engineer
|
|
|
|
|
Keep in mind that "$" is a special character, so you must escape it. The regular expression would look something like this:
^\$?((?!\$).)+(,\$?((?!\$).)+)*$
FYI, the tricky bit is called a "negative lookahead".
|
|
|
|
|
Hi ,
I have a string into clipboard (FirstName MiddleName Last Name). i want to paste this data into three different Textbox by a single paste in First Textbox.
ex . if i paste "Ravi Shankar Sharma"
then the data should appear like this
First Text box : Ravi
Second Text Box: Shankar
Third text box : Sharma
any one can help me
|
|
|
|
|
jQuery solution is pretty simples, but there is one weirdness, you cant read the value of the field until after it's been pasted, so I intoduce a short 1ms delay between paste, and trying to update the field:
$('#first').on('paste',function(e){
setTimeout(function(){
var text = $('#first').val().split(' ');
$('#first').val(text[0]);
$('#second').val(text[1]);
$('#third').val(text[2]);
},1)
});
Live example: http://jsfiddle.net/PjT28/[^]
I also don;t cover any of the multitude of error conditions (empty paste, paste without 3 names separated by a single space etc etc etc)
|
|
|
|
|
<html>
<head>
<title>Java Script - Capita Learning : ClipBoard Data </title>
<script type="text/javascript" >
function afterPaste(txt)
{
var T = window.clipboardData.getData('Text');
document.getElementById('Txt_Data2').value = T;
document.getElementById("Txt_Data3").value = T;
var len = T.length;
var n = T.indexOf(" ");
document.getElementById("Txt_Data2").value = T.substring(0,n);
T = T.substring(n+1,len);
len = T.length;
n = T.indexOf(" ");
document.getElementById("Txt_Data3").value = T.substring(0,n);
document.getElementById("Txt_Data4").value = T.substring(n+1,len);
}
</script>
</Head>
<body>
<p> On Paste event in java script
<p> <Input Type="Textbox" ID="Txt_Data" OnPaste="afterPaste(this.value)" >
<p> <Input Type="Textbox" ID="Txt_Data2" Name="Txt_Data2" >
<p> <Input Type="Textbox" ID="Txt_Data3" Name="Txt_Data3" >
<p> <Input Type="Textbox" ID="Txt_Data4" Name="Txt_Data4" >
</body>
</html>
|
|
|
|
|
hi,
I think this will work only in ie.what we can do for other browsers?
|
|
|
|
|
You could try putting Google Search to use........I am sure you could probably find something relevant in the time it took you to post that message.
|
|
|
|
|
The live() in the jQuery has been deprecated. Does anyone know the reason why?
|
|
|
|
|
They hide that sort of information in the documentation[^], the little buggers!
Use of the .live() method is no longer recommended since later versions of jQuery offer better methods that do not have its drawbacks. In particular, the following issues arise with the use of .live():
jQuery attempts to retrieve the elements specified by the selector before calling the .live() method, which may be time-consuming on large documents.
Chaining methods is not supported. For example, $("a").find(".offsite, .external").live( ... ); is not valid and does not work as expected.
Since all .live() events are attached at the document element, events take the longest and slowest possible path before they are handled.
On mobile iOS (iPhone, iPad and iPod Touch) the click event does not bubble to the document body for most elements and cannot be used with .live() without applying one of the following workarounds:
Use natively clickable elements such as a or button, as both of these do bubble to document.
Use .on() or .delegate() attached to an element below the level of document.body, since mobile iOS does bubble within the body.
Apply the CSS style cursor:pointer to the element that needs to bubble clicks (or a parent including document.documentElement). Note however, this will disable copy\paste on the element and cause it to be highlighted when touched.
Calling event.stopPropagation() in the event handler is ineffective in stopping event handlers attached lower in the document; the event has already propagated to document.
The .live() method interacts with other event methods in ways that can be surprising, e.g., $(document).unbind("click") removes all click handlers attached by any call to .live()!
|
|
|
|
|
So I am looking for a simple way for users to login to my website using their google+ account
I want to use javascript for it, is it possible and could anyone give me a little bit of a plan for it.
Let me know!
i have been looking around and i only figured it out in Csharp and the main developper wants it in javascript
help me out 
|
|
|
|
|
|
i have a questions you can help me ??
Q1) If you have two definitions for embedded CSS classes; classA , and classB. Write a
JavaScript statement that will be responsible for changing the DIV tag CSS class shown
below to classB ?
<div name="section1" class="classA"> …… </div>
A. section1.style.className="classB"
B. section1.class="classB"
C. div.className="classB"
D. section1.className="classB"
Q7. Which of the following is the correct JavaScript syntax to assign the file "bird.jpg" to the src property of an Image object called newImage?
A. newImage = "bird.jpg";
B. newImage.open("bird.jpg");
C. newImage.src("bird.jpg");
D. newImage.src = "bird.jpg";
Q8.The following code will:
var str="welcome in web";
document.writeln(str.link("www.web.com"));
A. display on the browser www.web.com as a hyperlink.
B. display on the browser welcome in web as a hyper link.
C. not display anything on the browser.
D. it is an error to write this javascript code.
Q11. For a webpage containing only one form shown below how can we obtain the value
entered inside the textbox in JavaScript?
<form name="sub">
First Number: <input type = "text" name = "first" size = "5"/> </form>
A. document.forms[1].first.value
B. sub.first.value
C. window.forms[0].first.value
D. sub.text.first.value
Q12. If we have the following radio buttons in form named Form1, which line of code
below could be used to determine if the Female option is checked?
Male <input type = "radio" name="gender" value="M" checked/>
Female <input type = "radio" name="gender" value="F"/>
A. Not checked since the Male option is already checked and cannot be changed.
B. Form1.gender[1].click();
C. Form1.gender.checked;
D. Form1.gender[1].checked;
Q13. Suppose that a JavaScript function was called upon pressing a form’s Submit
button. Which one of the following JavaScript code lines could prevent the action
of sending the form’s data to the server?
A. window.event.returnValue = false;
B. window.event.returnValue = true;
C. confirm( "Are you sure you want to reset?" );
D. window.event.formValue = false;
Q19) The output of the following html document is:
<html><head><title></title><script type = "text/javascript">
|
|
|
|
|
You could find many of these answers in your course notes or, the documentation at http://www.w3schools.com/[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
|
Some of the correct answers are such bad practice, that I feel that by teaching you this rubbish that your teachers are inadvertnatly providing me job security.
Thanks
|
|
|
|
|
If I do your exam for you, do I get the qualification?
|
|
|
|
|
Hi everybody.
I need to aggregate the content of two different lists in one space, into one webpart in a different sharepoint, and this should be done via JavaScript.
I cannot use designer and the Data View Web Part, which would ease the situation a lot...
Do you know any example on the web, or something? I have been googleling a lot but can't find anything like this.
Thanks.
|
|
|
|
|
Hi when i login into my application when i click the browser back button the page is reloded for that one
Please give me the code in javascript
|
|
|
|
|
Please clarify what it is you want to happen. Is clicking the back button resulting in a page you don't want, or do you want to make the browser go back from javascript? Or do you want something else perhaps?
It might be better to try and describe what it is you want to happen.
|
|
|
|
|
i want if i click the browser back button the current page is reloded ..please help me that one using javascript
|
|
|
|
|
Why do you want to do this?
I'm not trying to be difficult - stopping the browser back button (which is what you are trying to do in effect) isn't 100% reliable, for example the client might have JavaScript disabled. What you are doing works against the browser's functionality and you are trying to stop a user doing what they want on their own machine. See http://forums.asp.net/t/989339.aspx[^] for a discussion and this[^] (which is quite old).
IMO it is more likely you should be handling this on the server and displaying something appropriate, even if it is just a message saying you can't go back.
|
|
|
|
|
Your question is not clear. Generally, on using browser back button page is reloaded from cache. If you want to handle this behaviour, following tip would help: Browser back button issue after logout[^]
|
|
|
|
|
history Object Internet Explorer
---------------------------------
Contains information about the URLs visited by the client.
Attributes/Properties
Show:
Attributes/Properties
Methods
Method Description
back Loads a previous URL from the History list.
forward Loads the next URL from the History list.
go Loads a URL from the History list.
Property Description
length Retrieves the number of elements in the History list.
For security reasons, the history object does not expose the actual URLs in the browser history. It does allow navigation through the browser history by exposing the back, forward, and go methods. A particular document in the browser history can be identified as an index relative to the current page. For example, specifying -1 as a parameter for the go method is the equivalent of clicking the Back button.
back Method Internet Development Index
--------------------------------------------------------------------------------
Loads a previous URL from the History list.
Syntax
history.back( [iDistance])
Parameters
iDistance Optional. Integer that specifies the number of URLs to go back. If no value is provided, the previous URL is loaded.
Return Value
No return value.
Remarks
This method performs the same action as a user clicking the Back button in the browser.
The back method works the same as history.go(-1).
An error does not occur if the user tries to go beyond the beginning of the history. Instead, the user remains at the current page.
Standards Information
There is no public standard that applies to this method.
forward Method Internet Development Index
--------------------------------------------------------------------------------
Loads the next URL from the History list.
Syntax
history.forward()
Return Value
No return value.
Remarks
This method performs the same action as when a user clicks the Forward button in the browser. Calling the forward method works the same as calling the go method with a parameter of 1. An error does not occur if the user tries to go beyond the end of the history. Instead, the user remains at the current page.
go Method Internet Development Index
--------------------------------------------------------------------------------
Loads a URL from the History list.
Syntax
history.go(vLocation)
Parameters
vLocation Required. Variant that specifies an integer or a string. An integer indicates the relative position of a URL in the History list. A string indicates an exact URL in the History list.
Return Value
No return value.
Remarks
An error does not occur if the user tries to go beyond the beginning or end of the history. Instead, the user remains at the current page
|
|
|
|
|
function SetStateForNtimes(n) {
var popState = "?tabid=" + querySt("tabid");
for (i = 0; i <= n; i++) {
History.pushState({ state: 2, rand: Math.random() }, "RailEurope", popState);
}
}
function querySt(ji) {
hu = window.location.search.substring(1);
gy = hu.split("&");
for (i = 0; i < gy.length; i++) {
ft = gy[i].split("=");
if (ft[0] == ji) {
return ft[1];
}
}
}
Click here for more detail (History.js)
I have used somthing like above. It works like facebook has implemented.
Called this on ready state.
window.setTimeout("SetStateForNtimes(20)",2000);
Hope It will help.
Thank You,
Anjum Rizwi
|
|
|
|
|
Reloaded for which one..? Clarify your Question...
Vinod Kumar B C
Software Engineer
|
|
|
|