How can i handle a link which doesn't have a id, it just has a classname like "classbeauty".
Now i need to know if a user has clicked the link.
If the link is clicked i just need to call the alert("yes link clicked");
I don't know how to handle events in Javascript.
How can i do that?
I am not familiar with javascript and I have had some exposure to java but I found a web application that fits the goals of my app perfectly. The owner has provided the source by viewing the source in the html and I was wondering how hard it would be to reuse the code to deploy a similar app.
I'm working on a customized calculator, which is working pretty well except that I can't figure out how to get the generated numbers to display commas within the number. For example, it might spit out "450000" when I need it to say "450,000". This thread gives a number of suggestions on how to create a new function to deal with the problem, but I'm rather new to JavaScript and I don't really know how to make such a function interact with what I have now. I'd really appreciate any help as to how to get generated numbers with commas! :)
HTML:
<table id="inputValues">
<tr>
<td>Percentage:</td>
<td><input id="sempPer" type="text"></td>
</tr>
<tr>
<td>Price:</td>
<td><input id="unitPrice" type="text"></td>
</tr>
<tr>
<td colspan="2"><input id="button" type="submit" value="Calculate"></td>
</tr>
</table>
<table id="revenue" class="TFtable">
<tr>
<td class="bold">Market Share</td>
<td class="bold">Partner A</td>
<td class="bold">Partner B</td>
</tr>
<tr>
<td class="bold">1%</td>
<td><span id="moss1"></span></td>
<td><span id="semp1"></span></td>
</tr>
</table>
</form>
JavaScript:
<script>
function calc() {
var z = Number(document.getElementById('sempPer').value);
var x = Number(document.getElementById('unitPrice').value);
var y = z / 100;
var dm1 = .01 * 50000 * x * (1-y);
var se1 = .01 * 50000 * x * y;
document.getElementById("moss1").innerHTML= "$"+Number(dm1).toFixed(2);
document.getElementById("semp1").innerHTML= "$"+Number(se1).toFixed(2);
}
</script>
I have a asp.net textbox(textarea which is in a repeater have single texarea for each record which are read only) I have button (open in new window) when i click on it the content of the text area needs to be rendered in a new window using javascript .
Hi, i'm pretty new to Javascript and PHP so please bear with me if i'm asking some really dumbed down questions.
Ok, say i need to use values stored in a PHP $_GET or $_SESSION, is it advisable to just do something like
var something = PHP echo $_SESSION or $_GET
How do I test to see if links are external or internal? Please note:
I cannot hard code the local domain.
I cannot test for "http". I could just as easily be linking to my own site with an http absolute link.
I want to use jQuery / javascript, not css.
I suspect the answer lies somewhere in location.href, but the solution evades me.
Thanks!
I want to make sure I understand callbacks properly, and javascript timing etc. in general.
Say my code looks like this, is it gauranteed to execute in order?
SetList(); // initilizes the var _list
Some.Code(_list, function(data) {
// update list
});
DoSomething(_list); // operates on _list
Hello,
I'm trying to update values from a xml file into textboxes. I have this javascript being called in the Page_Load event
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", sb.ToString(), true);
I click the continue button which does a post back but the values are not updated until I refresh the page again which makes me think the js isn't being run until after the page is returned. I'm wondering how to have the values updated when the page is refreshed after the button postback.
thanks
does anyone knows how to resize image proportionaly using javascript?, i have tried to modify the DOM adding attributes height & Width on the fly, but seems did not work on IE6
I am looking for the best way to augment multiple javascript associative arrays.
For example the following code
a = { "one" : 1, "two" : 2 };
b = { "three" : 3 };
c = { "four" : 4, "five" : 5 };
d = Collect(a,b,c)
Should result in value of d being:
{ "one" : 1, "two" : 2, "three" : 3, "four" : 4, "five" : 5 };
What is the best way to do this?
Hello all,
I have a JavaScript variable that I echo out using PHP which is shown like this in the page source:
var db_1 = 'C:\this\path';
When I set the value of a text field with that variable like so:
$('#myinput').val(db_1);
The slashes have disappeared and only the other characters are left!
Why is this and how can I put the slashes back in??
Thanks all
is there any local file manipulation that's been done with javascript? i'm looking for a solution that can be accomplished with no install footprint like requiring AIR.
specifically, i'd like to read the contents from a file and write those contents to another file. at this point i'm not worried about gaining permissions, just assuming i already have full permissions to these files.
I'm new to Java and I'm doing a project with Ext JS and Java. I'm using Eclipse Java EE IDE for Web Developers (Build id: 20100218-1602). Can anyone suggest any Javascript debugging plugin for this build? Links appreciated
To reduce http request i want to mix multiple jquery plugin's javascript filesa and main jquery file into one.
What things should be considered?
Do we just need to place code from all files into new file one bye one or need to do something more. ?
How expensive are local variables (var v), global variables (window.v) and cross-global variables (parent.v) in JavaScript, in the major browsers? Has anyone performed any good tests on this one?
For server side generated content, i18n support is usually pretty easy, for example, Java provides extensive i18n support.
But, these rich server side libraries are not available within the browser, which causes a problem when trying to format data client side (AJAX style.)
What javascript libraries and techniques are recommended for performing client side formatting and time-zone calculations? Also - beyond simple client side formatting, how can consistency be achieved when performing both server side and client side formatting?
I have an HTML table which may contain thousands of rows (number of columns is not a problem here).
I would like to be able to browse this table easily and be able to do the following:
Decide how many rows will be presented
Jump to the next/previous X number of rows
Scroll the table using the scroll bars to any desired line
Be able to customize/extend easily this Javascript/jQuery code
Has anyone seen something similar ?
Thank you very much !
Hello,
I have added html controls through javascript, but when the page postback, all of the added controls are lost. Is there a way to retrieve it?
Thanks,
JV
Hello,
Is there a simpler way to rewrite the following condition in JavaScript ?
Thanks !
if ((x == 1) || (x == 3) || (x == 4) || (x == 17) || (x == 80)) {...}
What is the difference (if any) between the javascript strings defined below?
var str1 = "Somestring";
var str2 = 'Somestring';
"" and '' mean two very different things to me predominantly writing code in C++ :-)
EDIT: If there is no difference why are there two ways of achieving the same thing and which is considered better practice to use and why. Thanks!
hi,
I'm using the following lines to store the location of an object.
var lightboxTop = $('#lightbox').css('top');
var lightboxLeft = $('#lightbox').css('
left');
I'm successively moving this object in my element, and I want to restore it previous position with the stored variables.
But, I'm afraid javascript is saving the values by reference so I lose the initial positions. Am I correct ? How can I solve this ?
thanks
I'm learning Javascript right now. Can anybody tell me why the second code block traces a empty path for -launch(this)- but using the first code block it gives me the right path?
"<form action='"+launchwebsite+"/subsite/' method='post' target='_blank' onsubmit='launch(this)'>"
and this not:
"<a onclick='launch(this)' title='launch' class='iblack' /></a></div>"
Best
Uli