|
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#.
|
|
|
|
|
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"
|
|
|
|
|
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
|
|
|
|