Hi
How to format a textbox like "0.00" using Jquery or Javascript...If i enter value 59,then it should become 59.00.If i enter value as 59.20,then it should same....How it possible ....
I have link that calls a function when clicked:
<a href="javascript:spawnMenu(this);" id="link1">Test1</a>
To make my function work, I need access to the object so that I can perform jQuery operations like this:
alert($(objCaller).offset().left);
Since objCaller points to the object and not the object ID, this won't work. I need something like this:
alert($("a#link1").offset().left);
How can I get the object ID from objCaller?
I'm playing around with html5 and some javascript to make a minor sketchpad. Whenever I click down on the canvas in chrome, the cursor becomes a text cursor. I have tried putting cursor: hand in the css, but that doesn't seem to work. This has got to be an easy thing, but I look it up and can't find it anywhere
while coding javascript and ajax, there is no proper documentation for this function?
i searched this term using api src="http://www.google.com/jsapi " and searchControl.execute("abhilashm86");
how does this google.setOnLoadCallback(initalize) called internally? is this function just for a new search term when user clears previous search and starts new one?
How exactly this google.setOnLoadCallback(initalize) gets trigerred?
How to make multiple forms with shared fields without using javascript?
<input type=text name=username />
<form action="/users">
... some fields ...
</form>
<form action="/admins">
... some another fields ...
</form>
Is it possible to detect if a visitor is on the index page or domain root with client side scripting?
I figure javascript would be the best method as I would like to append a value to an image file based on wether a visitor is on the home page or not.
Non-index page:
<img src="/img/logo.png" />
Index page:
<img src="/img/logo-home.png" />
I want to debug a javascript file that is embedded in the HEAD element.
I navigate to the site, see the code, and make a breakpoint:
But when I click on Reload, the script disappears and it doesn't stop at the breakpoint:
Debugging was working earlier so I know it works in general. What do I have to do so that Firebug always debugs my script?
Hi,
Is it possible to refresh parent page from child's child page using javascript.
I have a webform which opens a child window, a button on child window closes the present child window and opens a subchild window. Now a button on subchild should close the window and refresh the parent form.
Please suggest me the way of doing it.
Thank You.
I'm trying to open simple vector graphics using Raphaël JS and I can't find any converter that would do the whole job.
Is there any way to transfer vector graphics (SVG or anything from Illustrator, Inkscape) into Raphaël's JavaScript?
Hi guys! Tried to make a little old school ajax (iframe-javascript) script. A bit of mootools is used for DOM navigation
Description:
HTML:
1 iframe called "buffer"
1 div called "display"
JAVASCRIPT: (short: copy iframe content into a div on the page)
1) onLoad on iframe triggers handler(), a counter makes sure it only run once
(this is because otherwise firefox will go into feedback loop. What i think happens: iframe on load handler() copyBuffer change src of iframe , and firefox takes that as an onload again)
2) copybuffer() is called, it sets src of iframe then copies iframe content into div, then erases iframe content
THE CODE:
count=0;
function handler(){
if (count==0){
copyBuffer();
count++;
}
}
function copyBuffer(){
$('buffer').set('src','http://www.somelink.com/');
if (window.frames['buffer'] && $('display') ) {
$('display').innerHTML = window.frames['buffer'].document.body.innerHTML;
window.frames['buffer'].document.body.innerHTML="";
}
}
problems:
QUESTION 1) nothing happens, the content is not loaded into the div. But if i either:
A) remove the counter and let the script run in a feedback loop: the content is suddenly copied into the div, but off course there is a feedback loop going on, you can see it keeps loading in the status bar.
OR
B) insert an alert in the copyBuffer function. The content is copied, without the feedback loop.
why does this happen?
QUESTION 2) The If wrapped around the copying code i got from a source on the internet. I am not sure what it does? If i remove it the code does not work in: Safari and Chrome.
Many thanks in advance!
UPDATE:
Like the answers said i have created an event handler. They used jQuery, i have made one in mootools:
window.addEvent('domready', function() {
$('buffer').addEvent('load', function(){
$('display').set('html',window.frames['buffer'].document.body.innerHTML)
window.frames['buffer'].document.body.innerHTML="";
}).set('src','somelink');
});
Bonus question:
3) Im new at stackoverflow (what an amazing place!), is it better if i make new threads for follow up questions?
I'm searching to select a text from a div, then click on a bookmarklet that remove all html parts in the body except the div where the text is selected
maybe jquery can help with something like :
javascript:var%20s=document.createElement('script');s.setAttribute('src',%20'http://jquery.com/src/jquery-latest.js');document.body.appendChild(s);s.onload=function(){/*the code*/};void(s);
I'm using the jQuery validate() plugin for some forms and it goes great. The only thing is that I have an input field that requires a special validation process. Here is how it goes:
The jQuery validate plugin is called in the domready for all the required fields.
Here is an example for an input:
<li>
<label for="nome">Nome completo*</label>
<input name="nome" type="text" id="nome" class="required"/>
</li>
And here is how I call my special function:
<li>
<span id="sprytextfield1">
<label for="cpf">CPF* (xxxxxxxxxxx)</label>
<input name="cpf" type="text" id="cpf" maxlength="15" class="required" />
<span class="textfieldInvalidFormatMsg">CPF Inválido.</span>
</span>
</li>
And at the bottom of the file I call the Spry function:
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1","cpf");
//-->
</script>
Of course I call the Spry CSS and JavaScript files in the head section as well as my special-validate.js.
When I just use the jQuery validate() plugin and click on the send button, the page goes automatically back to the first mistaken input field and shows the error type (not a number, not a valid email etc.).
But with this new function, this "going-back-to-the-first-mistake" feature doesn't work, of course, because the validate() function sees it all good.
I already added a rule for another form (about pictures upload) and it goes like this:
$("#commentForm").validate({
rules: {
foto34: {
required: true,
accept: "jpg|png|gif"
}
}
});
Now my question is, how can I add the special validation function as a rule of the whole validation process?
Here is the page to understand it better: link text and the special field is the first one: CPF.
I hope I was clear explaining my problem.
What bad things happen at the moment document.write() is invoked?
I've heard bits and peices about document.write having an adverse impact on the DOM or on the use of Javascript libraries. I have an issue in front of me that I suspect is related, but have not been able to find a concise summary of what damage the method does.
in javascript, how to make alert bold n use h1 to h5 headers? Is this possible or simply plain alert is option?
how to include bold and h1 to this alert?
function onlooad()
{
alert("wssup??");
}
hello...i have a problem with my project..i want to use barcode scanner for input data to textfield (i'm using jquery). this barcode scanner read serial number and model name of each product..but after scan, serial number and model name appear in one textfield. how to make them appear separately into different text field..first textfield for serial number and second textfield for model name...
is there some code to make it??use ajax,javascript or something else??
Hi,
I need to store about 20-30k or data on the client side when using a website.
I was using a cookie, but this is to small for my needs.
Is there something else that I can use?
I need to be able to do this via javascript.
Server side storage is a last resort but not what I am looking for.
I need it to work for Chrome, IE and firefox.
Thanks
Ian
I have a main form, which has button. By clicking on this button JQuery Dialog will shown. And contains of this dialog is a javascript bing map (using VEMAP object). So there are different js documents.
How can I create a context menu for bing map, opening in jquery dialog?
Thanks!
I am trying to use marker.setIcon() to change a markers image. However it appears that although this changes the marker.iconUrl attribute the icon itself is using marker.proprietary_marker.$.icon.image to display the markers image - so the markers icon remains unchanged. Is there a way to dynamically change the marker.proprietary_marker.$.icon.image?
Add a marker.
Check the icon's image url and the proprietary icon's image - they're the same.
Change the icon.
Again check the Urls. Now the Icon Url has changed but the marker still shows the old image which is in the proprietary marker object.
<head>
<title>Map Test</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=Your-Google-API-Key" type="text/javascript"></script>
<script src="mapstraction.js"></script>
<script type="text/javascript">
var map;
var marker;
function getMap(){
map = new mxn.Mapstraction('myMap','google');
map.setCenterAndZoom(new mxn.LatLonPoint(45.559242,-122.636467), 15);
}
function addMarker(){
marker = new mxn.Marker(new mxn.LatLonPoint(45.559242, -122.636467));
marker.addData({infoBubble : "Text", label : "Label", marker : 4, icon: "http://mapscripting.com/examples/mashups/richter-high.png"});
map.addMarker(marker);
}
function changeIcon(){
marker.setIcon("http://assets1.mapufacture.com/images/markers/usgs_marker.png");
}
function showIconURL(){
alert(marker.iconUrl);
}
function showProprietaryIconURL(){
alert(marker.proprietary_marker.$.icon.image);
}
</script>
</head>
<body onload="getMap()">
<div id="myMap" style="width:627px; height:412px;"></div>
<div>
<input type="button" value="add marker" OnClick="addMarker();">
<input type="button" value="change icon" OnClick="changeIcon();">
<input type="button" value="show icon URL" OnClick="showIconURL();">
<input type="button" value="show proprierty icon URL " OnClick="showProprietaryIconURL();">
</div>
</body>
</html>
Hi
I have a list in a div and I would like to change the background image of the parent div (#homepage_container) when I hover over a list item.
here's the site:-
http://www.thebalancedbody.ca/
Is this possible? I'm guessing I'll have to use javascript.
Thanks
Jonathan
I am trying to change the innerHTML of a div on the page that I am loading.
This is my JavaScript code:
function redirect(titleName){
window.location = "pageToLoad.php";
document.getElementById("title").innerHTML = titleName;
}
It doesn't seem to be working, please help me!!
I'm looking to create a custom date picker with code examples from several sources.
Is the code to display/hide an ASP.NET control when a user clicks a button usually done with JavaScript or ASP.NET code?
Please provide a simple example. (If ASP.NET, VB example preferred over C#)
I am using the following regex:
(public|private +)?function +([a-zA-Z_$][0-9a-zA-Z_$]*) *\\(([0-9a-zA-Z_$, ]*)\\) *{(.*)}
To match the following string:
public function messenger(text){
sendMsg(text);
}
private function sendMsg(text){
alert(text);
}
(There is no line breaks in the string, they are converted to whitespaces before the regex runs)
I wanted it to capture both functions, but it is capturing:
$1: ""
$2: "messenger"
$3: "text"
$4: " sendMsg(text); } private function sendMsg(text){ alert(text); "
By the way, I am using Javascript.
I want to run a local exe in my firefox extension javascript file, but ActiveXObject("WScript.Shell") is work fine in IE,not in FF,how to run a local exe in js in firefox.
I have a set of data in one JSON structure:
[[task1, 10, 99],
[task2, 10, 99],
[task3, 10, 99],
[task1, 11, 99],
[task2, 11, 99],
[task3, 11, 99]]
and need to convert it to another JSON structure:
[{
label: "task1",
data: [[10, 99], [11, 99]]
},
{
label: "task2",
data: [[10, 99], [11, 99]]
},
{
label: "task3",
data: [[10, 99], [11, 99]]
}]
What's the best way to do this with javascript/java?