|
| ||||||||||
| Tags: case sensitive, createrange, javascript, object structure, variable |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| How to change a variable that is saved in an object structure in JavaScript?
![]()
__________________ (\__/) (='.'=) This is Bunny. Copy and paste bunny into your (")_(") signatureto help him gain world domination |
|
#2
| |||
| |||
| Re: How to change a variable that is saved in an object structure in JavaScript?
Using the JavaScript that I have provided, your script will read the text that you are selecting, when you click the button. Here is the script for that : Code: <script type="text/javascript">
<!--
function getSelText()
{
var foundIn = '';
var txt = '';
if (window.getSelection)
{
txt = window.getSelection();
}
else if (document.getSelection)
{
txt = document.getSelection();
}
else if (document.selection)
{
txt = document.selection.createRange().text;
}
else return;
s = document.aform.selectedtext.value;
document.write(s);
s = s.replace(/Chr(8)/g,"\r");
document.aform.selectedtext.value = s;
document.aform.selectedtext.value = replace(document.aform.selectedtext.value, /Chr(8)/, "\r")
document.aform.selectedtext.value = document.aform.selectedtext.value + "\r" + txt;
}
// -->
</script> |
|
#3
| ||||
| ||||
| Re: How to change a variable that is saved in an object structure in JavaScript?
I think that the script mentioned by the 'void' should be changed a bit. The string "object" has a replace method built-in. The following is an example for that : Code: var str = 'this is a trial';
document.write(str.replace("is","was")); |
|
#4
| ||||
| ||||
| Re: How to change a variable that is saved in an object structure in JavaScript?
The method replace() searches for a match between a substring and a string. It also searches for a match between regular expression. And then after searching it replaces the matched substring with a new substring. Here is a Syntax for replace() : Code: string.replace(regexp/substr,newstring)
__________________ Signatures reduce available bandwidth |
|
#5
| ||||
| ||||
| Re: How to change a variable that is saved in an object structure in JavaScript?
You can also track an object structure change without any trigger. SQL Server 2005 provides you an excellent way to find when the table was last modified without adding any extra load on database. Following TSQL script gives you the last modified date of your table. Just replace the object name from testTable to your own object. Code: A select name,modify_date from sys.objects Where name =‘testTable’
__________________ I do to dead flowers what people at morgues do to dead people. Suck all the moisture out, dip them in plastic, paint them up pretty and put them in a nice frame. |
|
#6
| ||||
| ||||
| Re: How to change a variable that is saved in an object structure in JavaScript?
If you want to perform a case-sensitive search, then you can use the following script : Code: <script type="text/javascript">
var str="Visit Google!";
document.write(str.replace("Google", "TechArena"));
</script> Code: <script type="text/javascript"> var str="Visit Google!"; document.write(str.replace(/google/i, "TechArena")); </script>
__________________ IF you hate me, please don't mention it. I know who hates me and who doesn't. You really do not have to make fun of people.... |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "How to change a variable that is saved in an object structure in JavaScript?" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Scope of Object or variable in Object oriented Programming Languages | Dëfrim | Software Development | 3 | 08-01-2011 05:20 AM |
| How to Pass a Javascript variable to a PHP script | leshaspar | Software Development | 4 | 24-11-2010 09:48 AM |
| How to setup a JavaScript Object Notation variable? | hatred | Software Development | 4 | 04-02-2010 01:25 AM |
| Runtime Error 91 : Object Variable or with block variable not set | Ryan21 | Software Development | 2 | 28-08-2009 07:51 PM |
| javascript dynamic variable name | Lauren Bacall | Software Development | 3 | 17-06-2009 04:20 PM |