|
Does anyone know a JavaScript library that includes good functions for parsing URL's into their component parts?
Specifically, I would like to extract a query variable from the first URL and use it to construct a new URL.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
|
Thank you!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hello,
This is my first post to CodeProject. Please excuse if I commit some CodeProject "nono's," but point them out if you wish.
Anyways, I need help. I have only ever used <script> </script> in an html document to add functionality to a web page. But, I was recently given the task of implementing all of my JavaScript work from an outside .js file.
Here is what I know. I know I'll have to create and external .js file, and link it from my html. But what should it look like? I've never worked with raw JavaScript files before.
Here is my code:
<form name="myForm"> <!--
<fieldset id="inputs"> <!--
<ul> <!--
<li>
<label for="principal"> Principal(p): </label>
<input type="number" id="principal" name="principal" min="1" max="1,000,000"> <!--
</li>
<li>
<label for="intRate"> Yearly Interest Rate(r) (Enter as a decimal): </label>
<input type="text" id="intRate" name="intRate" placeholder="0.00" min="0" max="1"> <!--
</li>
<li>
<label for="length"> Loan Length(years): </label>
<input type="number" id="length" name="length" min="1" max="100">
</li>
<li>
<input id="clickme" type="button" value="Your Monthly Fate" onclick="loanPayment()"> <!--
</li>
</fieldset>
<fieldset id="output">
<li>
<input type="text" id="result" name="result">
</li>
</fieldset>
</ul>
A pretty standard form with some amateur comments. This all would normally go in the body of my html doc. Next, here's the function and variables within the <script> tags of the head:
<script>
function loanPayment()
{
var principal = document.getElementById("principal").value;
var intRate = document.getElementById("intRate").value;
var length = document.getElementById("length").value;
var R = intRate/12;
var Y = length*12;
var W = Math.pow((1+R),Y);
var F = (R * principal * W)/(W - 1);
F = F.toFixed(2);
document.getElementById("result").value = "Monthly Fate = $" + F;
}
</script>
How would this form be implemented into an html web page through the use of an external .js file? I'm very new to html/css/JS and I want to get it right. Thank you all and please try to be as detailed as possible; what's common sense to you might not be to me.
|
|
|
|
|
|
I began to develop addon for firefox and I had a problem.
var tabs = require('sdk/tabs');
tabs.on('ready', function (tab) {
tab.attach({
contentScript: "alert('azaza');",
onMessage: function(message) {
console.log("message");
}});
}
When I try to execute this code in Firefox nightly 36 it says "TypeError: window is null", but in Nightly 32 it works fine! In last fierfox (not nightly) this code not working too.
I tried to execute this code in nightly's browser debugger console, but the same result (window is null).
Help me, please.
|
|
|
|
|
|
Need to modify code to give PRODUCT of array
function start()
{
var theArray = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
var total1 = 0, total2 = 0;
var length = theArray.length;
for ( var i = 0; i < length; ++i )
{
total1 += theArray[ i ];
}
var results = "<p>Total using indices: " + total1 + "</p>";
for ( var element in theArray )
{
total2 += theArray[ element ];
}
results += "<p> Product using indices: " + total2 + "</p>";
document.getElementById( "output" ).innerHTML = results;
}
window.addEventListener( "load", start, false );
modified 16-Nov-14 19:18pm.
|
|
|
|
|
Member 11238538 wrote: Need to modify code to give PRODUCT of array Very interesting, now do you have a problem using multiplication?
|
|
|
|
|
Where are you stuck?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I have few article in PDF File. I want to set HTML Code into my pdf file for upload in my video Production Sarastoa. Can you give me information how can I set HTML Code for every PDF file?
|
|
|
|
|
I have a jQuery plug-in that set the date and time text into a HTML span. See the code below. How do I store the text in the span into the value of a text box?
$('#widgetCalendar').DatePicker({
flat: true,
format: 'd B, Y',
date: [new Date(now3), new Date(now4)],
calendars: 3,
starts: 1,
onChange: function(formated) {
$('#widgetField span').text(formated);
}
});
What I have tried is to set the span style="display:none" and used a textbox to receive the date which does not work:
<span style="display:none;"><asp:TextBox id="MyHiddenTextBox" runat="server" /><span>
Thanks,
Steve
|
|
|
|
|
To set the value of a text box, you need to use the .val(...) method[^], not the .text(...) method.
Your first call to .text(...) is replacing the text of all <span> elements within your widgetField element. Since you've wrapped the text box in a <span> tag, it will be destroyed by that call. You'll either need to be more specific with your #widgetField span selector, or remove the <span> which surrounds the text box.
Also, if you're using a master page, the name of your text box won't match the ID attribute set on the server.
<asp:TextBox id="MyHiddenTextBox" runat="server" style="display:none;" />
onChange: function(formatted) {
$('#widgetField span').text(formatted);
$('#widgetField input[name$=MyHiddenTextBox]').val(formatted);
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Every one,
i have recently started working on IE 11 migration work (Earlier the project is hosted by IE 7). i'm new to Jquery/Ajax. want to know what are the common issues that we might face when we host the webapplication in IE 11 rather than old browser IE 7.
|
|
|
|
|
By and large, you can continue to use the same code that you previously had in place by making sure that your markup targets the appropriate versions of HTML, and that you set a meta http-equiv="X-UA-Compatible" tag for IE-7. This will force compatibility mode where appropriate.
That said, in terms of modernizing your application base you will be pleasantly surprised, I think. HTML5 comes with way fewer hurdles than previous versions, and you'll find native support for things that you previously needed to do all kinds of JavaScript and CSS hacks to achieve. Provided that you maintain production code, you'll find that the focus is moving from a monolithic back-end with a slim client side to treating the browser as a UX/business layer and the servers simply provide the data layer. That's the modern paradigm, and it changes greatly where the focus is in terms of coding.
I would say that your biggest hurdle will be properly implementing and sticking with a security policy. The move of state and processing to the client side has resulted in more frequent dialog between clients and server, and if you don't validate that dialog properly you can expose serious vulnerabilities in your application.
After that, switching focus from your back-end of choice to JavaScript (and the menagerie of frameworks available for it) will be a learning curve, but not a terribly difficult one as long as you can keep a hold of what's happening at each processing stage.
At any rate, best of luck, and I promise you that after a little wadding through the learning curve, you will love the new technologies.
|
|
|
|
|
var a = [{"Id": 1, "Name": 'a'}, {"Id": 2, "Name": 'b'}, {"Id": 3, "Name": 'c'},{"Id": 4, "Name": 'd'},,{"Id": 5, "Name": 'j'}];
var b = [{"Id": 1, "Name": 'a'}, {"Id": 4, "Name": 'd'}, {"Id": 5, "Name": 'j'},{"Id": 9, "Name": 'i'}];
I need to remove duplicate in "a" by comparing "a" with "b" using underscore js
|
|
|
|
|
You need to post the code you have and then show us where you are stuck.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
|
Sorry, but is that supposed to be a question?
|
|
|
|
|
Hi, I would like to add a link from the browser which opens a video in the VLC application that everybody has installed here.
Is there a way of doing this in HTML or JavaScript?
|
|
|
|
|
I'm currently using an automation software to automate a series of steps I perform on my computer. One of the tasks involves hundreds of If/Then loops, extracts text from websites using an embedded web browser, computes equations and write text files.
The thing is, in order to share this with somebody else, they also need the same automation software installed, and then need to import it. So it's a process I'm trying to replace by creating a small program with a GUI that involves a simple installation on the user's PC (or ideally without installation). The language must be flexible enough to perform the same actions that I listed above - and more preferably. I'm a complete novice with anything besides HTML/CSS so I'm looking for
1) A flexible programming language that isn't rocket science to learn from scratch and is ideal for small stand-alone programs
2) The ability to create a GUI. I'd be happy to read any good reference you have about the language/design knowledge needed for GUI's.
Thanks in advance
|
|
|
|
|
|
its hard these days to say there's a 'best language' for anything - most languages can be bent into doing things they aren't 100% suited for - it all comes down to requirements
|
|
|
|
|
For this specific task... I'd suggest Python.
beMember wrote: 1) A flexible programming language that isn't rocket science to learn from scratch and is ideal for small stand-alone programs
Python was made to be a rapid prototyping language. It's also fast... and you can optimize certain things to be VERY fast with a little practice. Typically with most scripted languages, looping is slow... but Python allows you to import C/C++ functions/classes so that the typically slow portions are handed off to compiled code so that it runs fast.
beMember wrote: 2) The ability to create a GUI. I'd be happy to read any good reference you have about the language/design knowledge needed for GUI's.
Again, there's Python libraries for quick GUI development.
|
|
|
|
|
|