473,378 Members | 1,218 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

create Range for Other browsers (Cross Browser Compatibility)

I have a text box. When I write first text , then java script function will fire to check whether it is a number.

For IE , the following code is returning -1 value, But Other browsers it does not alert any value. Please help me

Expand|Select|Wrap|Line Numbers
  1. var selected = document.selection.createRange();
  2.  
  3. var decInSel = selected.text.indexOf('.');
  4. hasNegInSel  = selected.text.indexOf('-') != -1;
  5.  
  6. alert(decInSel);
May 21 '12 #1
3 2044
Dormilich
8,658 Expert Mod 8TB
reason is probably that IE & other browsers use a slightly different Range model.
May 21 '12 #2
Please help me how i can modify this to work in other browsers
May 21 '12 #3
Dormilich
8,658 Expert Mod 8TB
since I haven’t used Ranges myself, I can only point you to the appropriate references (MDN). (make sure to also check the links given there)
May 21 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: parksch2 | last post by:
I know there are a lot of articles out there about this subject but I have been reading for 3 hours and still can't find the answer. I have some text in a bunch of hidden spans. I need to find the...
2
by: Lüpher Cypher | last post by:
Does anyone know of good links about cross-browser compatibility (html attributes/css2/javascript)? -- - lüpher --------------------------------------------- "Man sieht nur das, was man...
7
by: dejavue82 | last post by:
Dear Asp.net users, I have seen some people comment that their asp.net websites render differently with various web browsers. Are they doing somthing wrong? In particilar, 1) I am wondering...
1
by: prof_martin | last post by:
Hi Everyone, I got question from Customer. What kind of browser and version which can browse properly if application running on ASP.net v.1.1 or 2.0 beside IE.5x above? Firefox, Nescape,...
15
by: CMM | last post by:
So I'm half way through overseeing a large project in ASP.NET 2.0. My superiors have decided that it would be nice if we ensured the site worked on all the major platforms (as they see it: IE,...
4
by: lanarkcp | last post by:
This section of code works perfectly in IE, but not Firefox or Netscape, where the paragraph formatting and color are lost. Suggestions?? Thanks. <head> <meta http-equiv="content-type"...
2
by: dwair | last post by:
Hi, I have been having browser compatibility issues and was wondering if anyone could help. I have been using a JavaScript array to populate marker data using ASP JS in a google Maps project. For...
3
dmjpro
by: dmjpro | last post by:
ActiveXObject is only supported by MS-IE or it is supported by others .... plz help me out .... thanx in advance .....
1
by: jonathanellis | last post by:
Hello: I am having a problem with a web site that i built not showing up properly in IE6. I haven't tested it in IE7, but I have tested it in Firefox and Safari. Both Firefox and Safari show the...
10
by: 101986 | last post by:
Hi, When i code a web page in XHTML, CSS, it works fine on mozilla, opera & google chrome, but gets distorted on internet explorer. Can you please suggest if i should use some specific coding...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.