|
I recommend "learning by doing", which, in your case, means not reading lots of text about the intricacies of the language (like in most JS programming books), but rather read the minimum necessary to start programming your first app. This approach is implemented in my tutorial book Engineering Front-End Web Apps with Plain JavaScript.
|
|
|
|
|
You can start with 'Object-Oriented javascript by Stoyan Stefanov'. Very simple language and start from basics. A must have book for any javascript programmer.
Prateek
|
|
|
|
|
|
I am brand new to coding of any kind. I am reading W3schools, Javascript String Methods, and one of the functions I don't understand is what is the function/purpose of Extracting String Characters?
These two codes are particularly unclear to me charAt() and charCodeAt(). When would they be used?
|
|
|
|
|
Member 11446034 wrote: charAt() and charCodeAt()
The charAt function[^] returns the character at the specified index. For example, if the string contains "Hello", s.charAt(0) will return "H" .
The charCodeAt function[^] returns the numeric Unicode value of the character at the given index. For example, if the string contains "Hello", s.charCodeAt(0) will return 72 , which is the Unicode value that represents an uppercase "H".
List of Unicode characters[^]
Member 11446034 wrote: When would they be used?
They would be used when you need to extract either a character, or the Unicode value of a character, at a particular index in a string.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
good information.
|
|
|
|
|
Hi,
I am new to jQuery, ajax and signalR.
I have this code in Popup.js file, I don't know what it is and I don't know how it executes, but I can understand that this code is to open popups one with close button and another without close button, because I commented and ran it, but I want to have the control over setting which popup to have close and which not. I am trying my best and placing the code in the aspx and ascx files.
I am not understanding, can some one please help me with this, and if I want to overwrite this same functionality in the local popup, page or user control how can I do that?
Any help code snippet, link or even suggestion would be greatly helpful
var control ={
---
convertLinkToPopupWithClose: function (event, informParentOnClose) {
return ELMS.WebControls.Popup.convertLinkToPopup(event, { showClose: true, closeInformsParent: informParentOnClose | false });
},
convertLinkToPopupWithoutClose: function (event, informParentOnClose) {
return ELMS.WebControls.Popup.convertLinkToPopup(event, { showClose: false, closeInformsParent: informParentOnClose | false });
},
----
}
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
modified 10-Feb-15 19:32pm.
|
|
|
|
|
I'm trying to to send form data to PHP via ajax but printout shows zero values. My JS editor indicates that one of the scripts below (commented) is invalid. I don't see it. help?
<!DOCTYPE html><html>
<!--To POST data like an HTML form, add an HTTP header with
setRequestHeader
(). Specify the data you want to send in the send() method:-->
<head>
<meta charset=utf-8>
<title>calculator insert form</title>
<style type="text/css">
input{
text-align:center;
}
</style>
</head>
<body><center>
<input type="text" size="45" align="middle" value="enter purpose
in box below" ><br>
<input type="text" align="middle" name="purpose" size="45" >
<FORM name="Keypad"
action="http://localhost/home/calcinsert.php" method="post">
<TABLE>
<TABLE border=2 width=50 height=60 cellpadding=1
cellspacing=5>
<TR>
<TD colspan=3 align=middle>
<input name="ReadOut" type="Text" size=24 value="0"
width=100%></TD>
<TD></TD>
<TD><input name="btnClear" type="Button" value=" C "
onclick="Clear()"></TD>
<TD><input name="btnClearEntry" type="Button" value=" CE "
onclick="ClearEntry()"></TD>
</TR><TR>
<TD><input name="btnSeven" type="Button" value=" 7 "
onclick="NumPressed(7)"></TD>
<TD><input name="btnEight" type="Button" value=" 8 "
onclick="NumPressed(8)"></TD>
<TD><input name="btnNine" type="Button" value=" 9 "
onclick="NumPressed(9)"></TD>
<TD></TD>
<TD><input name="btnNeg" type="Button" value=" +/- "
onclick="Neg()"></TD>
<TD><input name="btnPercent" type="Button" value=" % "
onclick="Percent()"></TD>
</TR><TR>
<TD><input name="btnFour" type="Button" value=" 4 "
onclick="NumPressed(4)"></TD>
<TD><input name="btnFive" type="Button" value=" 5 "
onclick="NumPressed(5)"></TD>
<TD><input name="btnSix" type="Button" value=" 6 "
onclick="NumPressed(6)"></TD>
<TD></TD>
<TD align=middle><input name="btnPlus" type="Button" value="
+ " onclick="Operation('+')"></TD>
<TD align=middle><input name="btnMinus" type="Button" value="
- " onclick="Operation('-')"></TD>
</TR><TR>
<TD><input name="btnOne" type="Button" value=" 1 "
onclick="NumPressed(1)"></TD>
<TD><input name="btnTwo" type="Button" value=" 2 "
onclick="NumPressed(2)"></TD>
<TD><input name="btnThree" type="Button" value=" 3 "
onclick="NumPressed(3)"></TD>
<TD></TD>
<TD align=middle><input name="btnMultiply" type="Button"
value=" * " onclick="Operation('*')"></TD>
<TD align=middle><input name="btnDivide" type="Button" value="
/ " onclick="Operation('/')"></TD>
</TR><TR>
<TD><input name="btnZero" type="Button" value=" 0 "
onclick="NumPressed(0)"></TD>
<TD><input name="btnDecimal" type="Button" value=" . "
onclick="Decimal()"></TD>
<TD colspan=3></TD>
<td><input type="button" name="btnEquals" class="red" value=" =
" onClick="Operation('='); this.form.submit();
event.returnValue = false;"></td>
</TR></TABLE></TABLE></FORM>
<a href="http://localhost/home/calcprint.php">Print</a>
</CENTER>
<font face="Verdana, Arial, Helvetica" size=2>
<script>
var FKeyPad = document.Keypad;
var Accumulate = 0;
var FlagNewNum = false;
var PendingOp = "";
function NumPressed (Num)
{
if (FlagNewNum)
{FKeyPad.ReadOut.value = Num;FlagNewNum = false;}
else {if (FKeyPad.ReadOut.value == "0") FKeyPad.ReadOut.value =
Num;
else FKeyPad.ReadOut.value += Num;}
}
function Operation (Op)
{
var Readout = FKeyPad.ReadOut.value;
if (FlagNewNum && PendingOp != "=");
else
{
FlagNewNum = true;
if ( '+' == PendingOp )
Accumulate += parseFloat(Readout);
else if ( '-' == PendingOp )
Accumulate -= parseFloat(Readout);
else if ( '/' == PendingOp )
Accumulate /= parseFloat(Readout);
else if ( '*' == PendingOp )
Accumulate *= parseFloat(Readout);
else
Accumulate = parseFloat(Readout);
FKeyPad.ReadOut.value = Accumulate;
PendingOp = Op;
}
}
function Decimal ()
{
var curReadOut = FKeyPad.ReadOut.value;
if (FlagNewNum)
{curReadOut = "0.";FlagNewNum = false;}
else
{if (curReadOut.indexOf(".") == -1) curReadOut += ".";}
FKeyPad.ReadOut.value = curReadOut;
}
function ClearEntry ()
{FKeyPad.ReadOut.value = "0";FlagNewNum = true;}
function Clear ()
{Accumulate = 0;PendingOp = "";ClearEntry();}
function Neg ()
{FKeyPad.ReadOut.value = parseFloat(FKeyPad.ReadOut.value) *
-1;}
function Percent ()
{FKeyPad.ReadOut.value = (parseFloat(FKeyPad.ReadOut.value) /
100) * parseFloat(Accumulate);}
</SCRIPT>
<script>
var js_var = "<br />whatever";
document.getElementById("link").onclick = OnCalc ();
{
var xhr;
if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else xhr = new ActiveXObject("Microsoft.XMLHTTP");
var url = 'http://localhost/home/calcinsert.php?js_var=' + js_var;
xhr.open('GET', url, false);
xhr.onreadystatechange = function ()
{
if (xhr.readyState===4 && xhr.status===200)
{
var div = document.getElementById("update");
div.innerHTML=xhr.responseText;
}
};
xhr.send();
return false;
}
</script>
</body></html>
-------------------- --------------
<?php
$servername = "localhost";$username = "root";$password = "cookie";
$dbname = "homedb";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn)
{ die("Connection failed: " . mysqli_connect_error()); }
$sql = "INSERT INTO calculator (purpose, value1, op, value2, total)
VALUES ('purpose', 'value1', 'op', 'value2', 'total')";
if (mysqli_query($conn, $sql))
{
echo "<center>";
echo "data entered<br><br>";
}
else
{ echo "Error: " . $sql . "<br>" . mysqli_error($conn); }
mysqli_close($conn);
header( "refresh:3;url='xxxxxxx'");
echo "<center>";
echo 'I\m old and slow</br>
in a rush, click
<a href="http://localhost/home/calcform.html">here</a>.'
?>
-------------------------------------
|
|
|
|
|
If you know which block of code it is complaining about then please edit your question, remove all the other stuff, and then format what's left for easier reading.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
My JS editor indicates that one of the scripts below (commented) is invalid. My major issue is OnCalc values not available to PHP.
<pre lang="PHP"><pre lang="PHP">
action="xxxxinsert.php" method="post">
print
// ************error indicated in below script********
var js_var = "
whatever";
document.getElementById("link").onclick = OnCalc ();
{
// ajax start
var xhr;
if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else xhr = new ActiveXObject("Microsoft.XMLHTTP"); // for IE
var url = 'xxxinsert.php?js_var=' + js_var;
xhr.open('GET', url, false);
xhr.onreadystatechange = function ()
{
if (xhr.readyState===4 && xhr.status===200)
{
var div = document.getElementById("update");
div.innerHTML=xhr.responseText;
}
};
xhr.send();
// ajax stop
return false;
}
----------------------------------
";
echo "data entered
";
}
else
{ echo "Error: " . $sql . "
" . mysqli_error($conn); }
mysqli_close($conn);
header( "refresh:3;url='xxxxxxx'");
echo "";
echo 'I\m old and slow
in a rush, click
here.'
?>
|
|
|
|
|
Hi All,
I am maintaining an application in which in client side script it is adding a button as below in which it showing some axd file, can some one explain me how can I go to this button click event?
When I went to the xxxxx/Prescreen folder location I don't find any file named Image.axd, what can I do to handle this situation.
Can anybody please help me in finding what exactly it means? any link, any suggestion or code snippet would be very helpful, all I want is to go and see what it doing when we click the "btnAdditionalFamilyQuestions" button.
<input type="button" name="btnAdditionalFamilyQuestions" id="btnAdditionalFamilyQuestions" value="Additional Family Questions" style="width: 215px;
background-image: url(http://localhost/xxx/xxxxx/Prescreen/Image.axd?r=0&g=178&b=214&p=20&h=25&t=Additional%20Family%20Questions);">
Thanks in advance.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Is Google not working where you are? The first result of searching of "axd": What is an .axd file? [Stack Overflow][^]
An .axd file isn't a physical file on disk; it's an IHttpHandler (or IHttpHandlerFactory ) registered in the web.config file.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Sorry, may be I was little quick to ask but I have been googling, but one thing I am not able to understand that how can I debug a file or code that's using axd extension, very unfortunate thing is as I have been writing lot of server side code for a while I am used to debug the code.
Can you please help me in that aspect, just in the below button click event it is opening a popup, how can I understand or debug what is it trying to do in that button click, what I understood is all that information can be obtained by that .axd file, but I am not sure how to crack it, please help me, if I wrongly understood please correct me.
<input type="button" name="btnAdditionalFamilyQuestions" id="btnAdditionalFamilyQuestions" value="Additional Family Questions" style="width: 215px;
background-image: url(http://localhost/xxx/xxxxx/Prescreen/Image.axd?r=0&g=178&b=214&p=20&h=25&t=Additional%20Family%20Questions);">
Thank you.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
If you look in your web.config file - either under system.webServer/handlers or system.web/httpHandlers , depending on whether your site is using the Integrated or Classic pipeline - you will see an <add ...> element with the path set to "image.axd" .
The type attribute on that element will tell you which class handles the image.axd requests.
Assuming you have the source code for that class, you should then be able to set a breakpoint within the ProcessRequest method and debug it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you so much, it is a great help for me, thanks a lot once again.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
http://jsfiddle.net/Trolstover/m1uwrzz1/1/[^]
Here is a sortable list which i made , but the question is, how can i invoke ondrop event on mouseover? Basicly i want to show position of selected(dragged) element (where it would be if you actually dropped it there)
|
|
|
|
|
The following is my HTML page. My problem is with invokeService(). It correctly determines the body and places it in data - but then it never sends the data. Fiddler shows no JSON data was sent. The Success routine is called but the data is null (as would be expected with no input data).
Can anyone tell me what I am missing or did wrong. How do I send the JSON to the service?
Thanks Brent
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test Voter Info</title>
<script type="text/javascript" src="jquery-1.4.1.js"></script>
<script type="text/javascript">
function invokeService() {
var value = document.getElementById("voter").value;
var loc = "https://www.voterfocus.com/mais/asmx/service1.asmx";
var body = "{'FVRSVoterIDNumber':'" + value + "', 'County':'lee', 'CKey':'------'}";
input.innerText = body;
$.ajax({
type: "POST",
url: loc + "/GetFVRSVoter",
data: body,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: ajaxSucceeded,
error: ajaxFailed
});
}
function ajaxFailed(data) {
result.innerText = data.status + ' ' + data.statusText;
}
function ajaxSucceeded(data) {
if (data != null)
result.innerText = data.d;
else
result.innerText = data;
}
</script>
</head>
<body>
<div style="width:100%; border: solid; margin: 2px; overflow: auto; height: 100px;">
One Voter: <input type="text" id="voter" />
<input type="button" onclick="invokeService();" value="GO" />
</div>
Input Body:
<div id="input" style="width:100%; border: solid; margin: 2px; overflow: auto; height: 190px;">
</div>
Raw Result:
<div id="result" style="width:100%; border: solid; margin: 2px; overflow: auto; height: 300px;">
</div>
</body>
</html>
Brent
|
|
|
|
|
If it hits the success function that tells me it called your service correctly. Did you put a breakpoint in your webmethod?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
The service is not mine, unfortunately, but, like I said, Fiddler confirms that no data was sent. Is there something I need to do to prepare the data to be sent?
Brent
|
|
|
|
|
What is the signature for your GetFVRSVoter() method?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I'm wondering if I'm wasting my time here.
History: Our vendor created this service and also gave us a web site where everything works, but he never gave us access to the WSDL. My employer wanted it to do something different, so asked me to extract the functionality and use it in our own web site. So I don't even have a signature, I am just copying out what is in the vendor's JavaScript file. Is doing something like that even possible? Or am I running in to cross-site scripting problems? This could be something entirely different.
But when I run the same script in the vendor's web page, Fiddler shows the data being sent and so when mine gets called and no data is sent, I am just hoping it is me doing something wrong instead of me trying to do something impossible.
Thanks
Brent
|
|
|
|
|
Thanks for the additional info. It is possible you are having cross-site issues; however, I believe the error function is called when that happens.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
It may be a proxy authentication problem. I managed to get it working in c#, but had to use proxy authentication.
How would I do proxy authentication for this in javascript?
Brent
|
|
|
|
|
dbrenth wrote: How would I do proxy authentication for this in javascript? Not sure. I haven't had to do that in JS but here's the documentation for .ajax, http://api.jquery.com/jquery.ajax/[^]. If it can be done it would be using one of those properties, perhaps the headers.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
dbrenth wrote: Or am I running in to cross-site scripting problems?
That's the most likely issue - cross-domain AJAX requests won't work without making changes to the server you're calling. You would either need to change the service to use JSONP[^], or set the Access-Control-Allow-Origin header[^] on the server to allow calls from your site.
If you don't have access to the server that's hosting the service, there's nothing you can do from the client side. You'd need to write your own service to proxy calls to the remote service for your site. The client-side code would call your service; your service would then call the original service, and return the results to the client.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|