473,385 Members | 1,830 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,385 software developers and data experts.

javascript should support in mozilla

12
i have javascript functions in my requirement but htat is working in IE but it is not working in mozilla
Jun 26 '07 #1
3 1054
gits
5,390 Expert Mod 4TB
hi ...

please be more specific ... what code is not working ... please post it or post an similar example ... so that we are able to help you ...

kind regards ...
Jun 26 '07 #2
Nivetha
12
thanks i have function like fixing the cursor postion in textarea..like in my text area
i keep my cursor position i should take the value from list initially one by one it will add in the last position as defult but in mozilla its adding only in the first but in Ie it works properly..


function setCursorPos() {
globalCursorPos = getCursorPos(FileColumnData.messageText);


}


function getCursorPos(textElement) {

var sOldText = textElement.value;

var objRange = document.selection.createRange();
var sOldRange = objRange.text;

var sWeirdString = '#%~';

objRange.text = sOldRange + sWeirdString; objRange.moveStart('character', (0 - sOldRange.length - sWeirdString.length));

var sNewText = textElement.value;

objRange.text = sOldRange;

for (i=1; i <= sNewText.length; i++)
{
var sTemp = sNewText.substring(i, i + sWeirdString.length);
if (sTemp == sWeirdString) {
var cursorPos = (i - sOldRange.length);
return cursorPos;
}
}
if(sOldText != "") {
return sOldText.length;
}

return 0;
}

function insertdata()
{
var msg = document.FileColumnData.columnData.value;
var firstPart = FileColumnData.messageText.value.substring(0,globa lCursorPos);
var secondPart = FileColumnData.messageText.value.substring(globalC ursorPos,FileColumnData.messageText.value.length);
document.FileColumnData.messageText.value = firstPart + msg + secondPart ;
document.FileColumnData.messageText.focus();

}
<script>
var globalCursorPos = FileColumnData.messageText.value.length;
</script>

function insertString(stringToInsert) {
var firstPart = FileColumnData.messageText.value.substring(0, globalCursorPos);
var secondPart = FileColumnData.messageText.value.substring(globalC ursorPos,FileColumnData.messageText.value.length);
document.FileColumnData.messageText.value = firstPart + stringToInsert + secondPart;
document.FileColumnData.messageText.focus();
}



this is the code iam using in my jsp
Jun 26 '07 #3
gits
5,390 Expert Mod 4TB
hi ...

how do you refer to the textelement ... the typical way that works in all browsers would be:

Expand|Select|Wrap|Line Numbers
  1. var element_ref = document.getElementById('element_id');
  2. var element_value = element_ref.value;
try to refer that way.

kind regards ...
Jun 26 '07 #4

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

Similar topics

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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.