JavaScript Experts,
I have the following HTML. How could I use JavaScript such that when a user clicks on the checkbox in each row the phone numbers and e-mail addresses are partially obfuscated with asterisks? - <table><tr><form method='post'><td>phone:</td><td>21323</td><td width='10%' align='right'>mail:</td><td>bob@example.com</td><input name='submit' type='submit' value='check'><input type='hidden' name='nameid' value='6' ></form></tr></table>
Dis question is asked to forwarded to javascript ... By Nicodemas in above format...
Am facing a problem, with this script...
I want two fields to be written by star , in order to hide . and this script does it , but ,
wat actually is my page opens directly with star letter , rather i need to open my page with the phoneno and email aftr clicking the button i want to make a change to the star to the respective fields ..........
How can i do this...
Page should open like ..
21323 dsad@dsa.com
check (button) aftr clicking
then
213***
ds**@***** -
vbscript
-
function getPhone(text)
-
dim textsize
-
textsize = Len(text)
-
text = Left(text,5)
-
For index = 0 to textsize
-
text = text & "*"
-
Next
-
getphone = text
-
End Function
-
Function getEmail(text)
-
dim textsize
-
textsize =Len(text)
-
dim atpos
-
atpos = instr(text,"@") - 5
-
text = Left(text,5)
-
For index = 0 to textsize
-
if atpos = index+1 then
-
text = text & "@"
-
else
-
text = text & "*"
-
end if
-
Next
-
getemail = text
-
End Function
-
Set oConn = Server.CreateObject("ADODB.Connection")
-
Set oRs = Server.CreateObject("ADODB.Recordset")
-
oConn.Open "Provider=SQLOLEDB; Data Source = ria; Initial Catalog = northwind; Integrated Security = sspi;"
-
sSql = "SELECT phone,email,id FROM tbl1 userid =4 "
-
oRs.Open sSql, oConn
-
While not oRs.EOF
-
Response.write("<table><tr><form method='post'><td >phone : </td><td>"&getPhone(ors(0))&"</td><td width='10%'align='right'mail :</td><td>"&getEmail(ors(1))&"</td><input name='submit' type='submit' value='check'><input type='hidden' name='nameid' value='" & ors(2) & "' ></form></tr></table>")
-
oRs.MoveNext()
-
Wend
-
ors.close
-
oconn.close
-
if request.form("submit")="check" then
-
i=1
-
end if
-
if request.form("nameid") <> "" then
-
set star1 = oConn.Execute("select resid from tbl1 where id= '" &request.form("nameid")&"'")
-
if not star1.eof then
-
sl = "UPDATE tbl1 SET star = '" & i & "' where resid= '" &request.form("nameid")&"' and userID = " & userid
-
oConn.Execute sl
-
End if
-
End if
-
%>
-
13 2257
You'll need to use JavaScript rather than VBScript. Have you made a start on the JavaScript code?
PS. the [code] tags have numbered lines - there's no need to add them manually.
But , i found one problem , that i couldn able to store the changes .
I mean this eg shows , (done by javascriipt)
Visualise this eg
Page open like this..
12332 sdfdf@dsdfs.com
Check (button) if clicked
Changes to dis
123****
sdf**@*****
But if i refresh the page,
it again change to
12332 sdfdf@dsdfs.com
so, am not able hold the obfuscated value , untill i change.....
i need to hold the obfuscated value....thats y i tried server side....
plz suggest..
So, initially you want it displayed, but as soon as it's replaced by asterisks, it should remain that way?
If that's the case, you'll have to use server-side code. You can submit and change the database (or wherever the data is stored) so when you next refresh or display the page, the asterisks are there.
If you want to avoid a reload of the page when replacing, you can use Ajax.
I dunno much about ajax . .
how can i do this... as my script ensures to make a obfuscated values .
but problem is , it directly opens directly with obfuscated values , i want to happen aftr clicking button , and have to be permanent untill i change...
Should the "obfuscation" happen without reloading/unloading the page? If so, then Ajax it is, otherwise you only need server-side code. Let me know which it is.
plz , U can tell me , how can i do it . .
Coz i need to hold the value of those obfuscated details . so, that i can see the values when i loaded again .
Thanks ...
Here's a link to help get you started. Post back if you get stuck.
This is what i understood, Am i right with these things..?
Yes . ajax is one which supports latest browsers where any functions can be called by javascript , and the functions status can be checked by readystate function , so whether the connection is success or not
So, aftr these steps, We have two options to do our need ,
Responsetext--> Some Text
Responsexml-->some xml documents travering by javascript functions..
Need some more clarity in Open, send ....
@sureshl
open() is comparable to the (HTML) form element, while send() is starting the http request (sending the variables)
see XMLHttpRequest – MDC
regards
This is my first ajax code...Okay , For my issue ,
I converted my vbscript to javascript , Is my coding is correct , Now i need to work such a way to convert my clear text to obfuscated values . . -
function makeRequest(url) {
-
var httpRequest;
-
-
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
-
httpRequest = new XMLHttpRequest();
-
if (httpRequest.overrideMimeType) {
-
httpRequest.overrideMimeType('text/xml');
-
// See note below about this line
-
}
-
}
-
else if (window.ActiveXObject) { // IE
-
try {
-
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
-
}
-
catch (e) {
-
try {
-
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
-
}
-
catch (e) {}
-
}
-
}
-
-
if (!httpRequest) {
-
alert('Giving up :( Cannot create an XMLHTTP instance');
-
return false;
-
}
-
httpRequest.onreadystatechange = function() { getphone(text); getemail(text); };
-
httpRequest.open('GET', url, true);
-
httpRequest.send('');
-
-
}
-
-
/*function alertContents(httpRequest) {
-
-
if (httpRequest.readyState == 4) {
-
if (httpRequest.status == 200) {
-
<!--alert(httpRequest.responseText);-->
-
} else {
-
alert('There was a problem with the request.');
-
}
-
}*/
-
function getPhone(text)
-
{
-
if (httpRequest.readyState == 4)
-
{
-
if (httpRequest.status == 200)
-
{
-
var textsize
-
textsize = Len(text)
-
text = Left(text,5)
-
For (index = 0 ;index <=textsize ; index++)
-
{
-
text = text & "*"
-
}
-
getphone = text
-
}
-
else
-
{
-
alert('There was a problem with the request.');
-
}
-
}
-
-
function getEmail(text)
-
{
-
if (httpRequest.readyState == 4)
-
{
-
if (httpRequest.status == 200)
-
{
-
var textsize
-
textsize =Len(text)
-
var atpos
-
atpos = instr(text,"@") - 5
-
text = Left(text,5)
-
for(index = 0 ; index<=textsize ; index ++ )
-
{
-
if atpos = index+1 then
-
text = text & "@"
-
}
-
else
-
{
-
text = text & "*"
-
}
-
}
-
getemail = text
-
}
-
</script>
If the above code is correct , how can i call this ajax script in my code , - Set oConn = Server.CreateObject("ADODB.Connection")
-
Set oRs = Server.CreateObject("ADODB.Recordset")
-
oConn.Open "Provider=SQLOLEDB; Data Source = ria; Initial Catalog = northwind; Integrated Security = sspi;"
-
sSql = "SELECT phone,email,id FROM tbl1 userid =4 "
-
oRs.Open sSql, oConn
-
While not oRs.EOF
-
Response.write("<table><tr><form method='post'><td >phone : </td><td>"&getPhone(ors(0))&"</td><td width='10%'align='right'mail :</td><td>"&getEmail(ors(1))&"</td><input name='submit' type='submit' value='check'><input type='hidden' name='nameid' value='" & ors(2) & "' ></form></tr></table>")
-
oRs.MoveNext()
-
Wend
-
ors.close
-
oconn.close
Before we go any further, the only benefit Ajax would provide here is that the "obfuscation" would take place almost instantly without having to submit a form and unloading the page. If that's not important, Ajax is not necessary and you can simply submit the form to a server-side page (code you already have) and display the values with parts replaced by asterisks.
Now my present code and Problem i had explained....
my below retreives only first data...i mean only this...
12343 dsf@sd.ds ,
i want to retrieve all the data, for those uservalue has id =1
My db :
tbluser
uservalue id
2 1
3 1
4 1
5 1
and using this uservalue it rerieves phone, email from this table
tblstudent
phone email uservalue
12343 dsf@sd.ds 2
123231 dsf@ds.df 3
123231 sfd@dfs.ds 4 -
set chk =oConn.execute("select uservalue from tbluser where id = 1")
-
if not chk.EOF then
-
id =chk("uservalue")
-
sSql = "SELECT phoneno,email,id FROM tblstudent where uservalue = " & id
-
oRs.Open sSql, oConn
-
While not oRs.EOF
-
Response.write("<table><tr><form method='post'><td >phone : </td><td>" & getphone(ors(0)) & "</td><td width='10%'align='right'mail :</td><td>"& getEmail(ors(1)) &"</td><input name='submit' type='submit' value='check'><input type='hidden' name='nameid' value='" & ors(2) & "' ></form></tr></table>")
-
oRs.MoveNext()
-
Wend
-
end if
-
if request.form("submit")="check" then
-
i=1
-
end if
-
if request.form("nameid") <> "" then
-
set star1 = oConn.Execute("select resid from tbl1 where id= '" &request.form("nameid")&"'")
-
if not star1.eof then
-
sl = "UPDATE tbl1 SET star = '" & i & "' where resid= '" &request.form("nameid")&"' and userID = " & userid
-
oConn.Execute sl
-
End if
-
End if
-
Your best bet for that would be the ASP forum. If you do decide to grapple with Ajax again, you can come back to this thread.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: fix |
last post by:
Hello,
i need to protect my xsl file.
In my xsl i have a mechanism for defining a personal stylesheet, what i want to do
is, if it possible, find a mechanism for Obfuscated the xsl source code ....
|
by: Kim Scarborough |
last post by:
Say I wanted to put a couple lines of asterisks between paragraphs, and have
it stretch the spaces so that it spanned 100% of the text-width, like this:
* * * * * ...
|
by: Steve |
last post by:
I'd like to create a form where required fields are marked by
asterisks. The asterisks would then disappear as the field or
checkbox is filled in by the user.
If there's a way to do this with...
|
by: assaf |
last post by:
hi all
i am using PreEmptive Solutions dotfuscator (community edition).
and i am getting 'TypeLoadException' for a simple interface that i defined.
how can i debug an obfuscated application?
...
|
by: Susan Bricker |
last post by:
I would like to have a transparent command button on my Main Menu to
cause an Inputbox( ) to be displayed for the user to enter a password.
This is to control the enabling of Bypass Key (shift). ...
|
by: Paul E Collins |
last post by:
For those who appreciate such things, here's a bit of obfuscated C# I
knocked up in a spare moment at work.
http://CL4.org/comp/jabberwocky.txt
P.
--
www.CL4.org
|
by: Kahlia |
last post by:
Hi. I am trying to print a pyramid of asterisks using recursion so that the recursive function takes in an integer and prints that number of lines of asterisks and then reverses, eg:
*
...
|
by: D.M. Procida |
last post by:
In music (apparently) when listing a composer's compositions, a single
asterisk against a performance item denotes that it is a premiere (i.e.
in that country), and two asterisks that it is a world...
|
by: ab12 |
last post by:
I'm trying to write a program in C that gets a shape outlined with asterisks from the user, and returns that shape filled with asterisks. It will also get the coordinates of a point inside the shape...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |