Hello. I have an image on my website. I would like when I click it, it show a , and when I click it another time, it hides the .
How can I do this in JavaScript? Should I use jQuery?
I need to make 3:4 window, where 3 is 75% of screen. How could i set width? Like if i have 100px height and 10000000000000px width monitor, than i shold have 75:100px window.
I heard that it could be done with the help of Javascript.
what is difference between this two function
1.
$(document).ready(function myfunc()
{
function do something();
});
2
<script language="javascript">
function dosomething(){
// do something
}
</script>
Folks, I have a HTML file which contains a button called "Email this content to me". Upon pressing this button, I want the complete HTML content of the file to be emailed to me.
Can someone tell me if there is a javascript function to do that. A short example would go a long way :)
Thanks in advance
this website here:
http://www.offpricecars.com/inventory2.html?F=C
when you select a dropdown the record based on your selection is displayed. ive tried copying it to localhost and it wont work. ive also tryed reading its headers and cant seem to figure out how javascript is making the records display on selection. i do understand that its extension isnt really html and might be another but based on how its operating as a html file i cant seem to find anywhere on how its sending the string to show the records.
thanks
In a Django template, how could I refer to the URL. I want to use it in static pages, to avoid having live links to the current page. Is there a way to do this with the Django template language or do I have to use JavaScript to do it?
I would like to do something like
{% if current_url == "/about/" %}
About
{% else %}
<a href='/about/'>About</a>
{% endif %}
I'm using it for a simple blog, so there are no views written for those pages.
I want to break the following string at the word To and then truncate the email address that follows at 15 characters using JavaScript. This is the sentence:
Please email this card to [email protected]
It should like like this:
Please email this card
to email@emailadd...
Is there anyway to get the alt tag to display quicker?
Also, I notice it doesn't show in all browsers. I know I should craft a javascript tooltip but I am looking for something really lite with minimal code.
I have an approach in mind for an image viewer in a web app, and want to get a sanity check and any thoughts you stackoverflowers might have.
Here's the whirlwind nutshell summary: I'm working on an ASP.NET MVC application that will run in my company's retail stores. Even though it is a web application, we own the store machines and have control over them. We have a "windows agent" running on the store machine which we can talk to via http post (it is a WCF service, and our web app has permission to talk to it from the browser).
One of the web pages needs to be an "image viewer" page with some common things like Rotate & Zoom.
Now, there are some WebForms controls that offer Rotate and Zoom. However, they take up server resources and generate a good bit of traffic between the server and the browser. For example, the Rotate function would cause an ajax call to the server, which would then generate a new image written to a .NET Canvas object, which would then be written to a file on the server, which would then be returned from the ajax call and refreshed inside the browser.
Normally, that's a pretty good way of doing things. But in our case, we have code running on the store machine that we can communicate with. This leads me to consider the following approach:
When the user asks to view an image, we tell our "windows agent" to download it from our image server to the store machine.
We then redirect our browser to our image viewer page, which will pull the image from the local file we just wrote to the store machine.
When the user clicks "Rotate", we cause JavaScript code in the browser to call our "windows agent" software, asking it to perform the "Rotate" function.
The "windows agent" does the rotation using the same kind of imaging control that would formerly have been used on the server, but it does so now on the store machine.
Javascript in the browser then refreshes the image on the page to show the newly rotated image.
Zoom and similar features would be implemented the same way.
This seems to be much more efficient, scalable, and responsive for the end-users. However, I've never heard of anything like it being done, mostly because it's rare to have this combination of a web app plus a "windows agent" on the client machine.
What do you think? Feasible? Reasonable? Any pitfalls I overlooked or improvements / suggestions you can see? Has anyone done anything like this who would like to offer the wisdom of experience?
Thanks!
I'm writing part of a web page that allows a user to build a table and fill it with information. In the course of building the table, the user will be adding additional columns with headers. I'd like to code it so when the combined width of all the headers causes one of them to wrap that the table columns switch to using vertical text (writing-mode: tb-rl). Is there any way, using JavaScript, to determine if the contents of a specific cell have wrapped?
Thanks, Spara
Hi all
I am using the following javascript code to refresh another page
window.opener.location.replace(url)
The problem is when entering the url, do not find the page as the page is located in the root and this calling code is placed in a page inside another folder. How do I specify the path to point to the root, which is where the page is located? I have try many things, but it does not work; //page.aspx, ../page.aspx, ~/page.aspx, page.aspx, /page.aspx....
Many thanks in advanced
Hello, whenever we go to Google Page and click on the "more", a menu will be dropped down. I would like to have the following effect on my web site too. May I know which JavaScript library can help me to achieve the similar effect?
I have a very simple WCF service I would like to pass it an array or json?
[OperationContract, WebGet(ResponseFormat = WebMessageFormat.Json)]
public string GetPreDisplay(string inputData)
{
//DoSomething with inputData
return "Sweet!";
}
My javascript...
var data = [paymentControls['claimNum'], paymentControls['claimSeq']];
$lps.GetPreDisplay(data, onComplete);
Obviously string is the wrong type. Can anyone point me in the right direction?
Thanks,
~ck
Iam debugging some javascript, and cant explain what this "||" does?
loadingError: function(title, msg){
var title = title || 'Error';
var msg = msg || 'Error on Request';
new my.widget.InformationBox({
title: title,
message: msg,
type: 'error'
}).show();
}
Can someone give me an hint, why this guy is using var title = title || 'ERROR' ??
Hi,
I am not so good with regex. I am struggling to find a solution for a small functionality.
I have a ajax response which returns a string like "Your ticket has been successfully logged. Please follow the link to view details 123432."
All I have to do is replace that number 123432 with <a href="blablabla.com?ticket=123432"> using javascript.
I am using a form to "Rate" a page. This form "posts" data to a php script elsewhere. I simply want to display a link after the form is processed which will bring the user back to previous page. Can I do this using javascript in my php script?
GF
Hello,
I was wondering about the different ways of using a JQuery function on a variable
like I know this one
$.DoThis(variable);
but is there a way to call it at the end like normal Javascript functions
variable.$.DoThis();
haha I know this sounds stupid but I need to ask somewhere. Thanks!
I think the question is clear enough, but I'd like to clarify it because it's subjective at some point and I don't want it closed.
I want to see some short jQuery examples with awesome results (either from the user or from the programmer perspective), that would not be that easy using straight javascript without any library.
I find this question useful to be aware how using jQuery simplifies your js code.
Hi All,
I am trying to build a shopping cart site. When a user click add to cart image on the product page, The product title will show a "The product is in your cart" text without reloading the page. I am using session and ajax but no luck so far. I appreciate any helps.
My html cold
<table id="<?php echo $productId; ?>" width="594" border="0" cellpadding="5" cellspacing="0">
<tr>
<td><img src="<?php echo "$brandImage"; ?></td>
<td <?php echo $productName; ?> //The "The product is in your cart" will be showed here</td>
</tr>
<tr>
<td><a class="addToCart" href="javascript:void(0);" onclick="addToCart(<?php echo $productId?>)">
</td>
My Javascript file (addToCart.js)
function addToCart(productId){
var url="addToCart.php";
url=url+"?productId="+productId;
url=url+"&sid="+Math.random();
$.post(
url,
function(responseText){
alert(responseText); //I wish I can get productData value from addToCart.php
},
"html"
)
My php file (addToCart.php)
<?php SESSION_START();
$productId=$_GET['productId'];
$cart=$_SESSION['cart'];
if(isset($cart)){
$cart.=",".$productId;
$product=explode(',',$cart);
$totalItem=count($product);
}else{
$cart=$productId;
$totalItem=1;
};
$productData=array();
foreach($product as $id){
$productData[$id]=(isset($productData[$id])) ? $productData[$id]+1 :1;
};
$_SESSION['cart']=$cart;
//print_r($productData);
echo $productData; //Not sure what to do to send $productData back to my addToCart.js variable
?>
I tried to make the code look simple. Any suggestion will be a great help. Thanks
How do you encode a javascript object/hash (pairs of properties and values) into a URL-encoded query string with YUI (2.7.0 or 3.0.0 Beta) ?
I want to do the equivalent of Object.toQueryString() from Prototype:
I need this to encode parameters for GET and POST requests with YAHOO.util.Connect.
It turns out YAHOO.util.Connect has a setForm() method to serialize a form but that still leaves me out cold to encode parameters for GET requests, or the 4th parameter of YAHOO.util.Connect.asyncRequest() to pass post data.
Hi Guys,
I was wondering if anyone has had any valid experience with JCE Pro ? http://www.syntropy.se - javascript obfuscation
Or any other good obfuscation methods for that reason ?
Like every other web developer on the planet, I have an issue with users double clicking the submit button on my forms. My understanding is that the conventional way to handle this issue, is to disable the button immediately after the first click, however when I do this, it doesn't post.
I did do some research on this, god knows there's enough information, but other questions like Disable button on form submission, disabling the button appears to work. The original poster of Disable button after submit appears to have had the same problem as me, but there is no mention on how/if he resolved it.
Here's some code on how to repeat it (tested in IE8 Beta2, but had same problem in IE7)
My aspx code
<%@ Page Language="C#" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script language="javascript" type="text/javascript">
function btn_onClick()
{
var chk = document.getElementById("chk");
if(chk.checked)
{
var btn = document.getElementById("btn");
btn.disabled = true;
}
}
</script>
<body>
<form id="form1" runat="server">
<asp:Literal ID="lit" Text="--:--:--" runat="server" />
<br />
<asp:Button ID="btn" Text="Submit" runat="server" />
<br />
<input type="checkbox" id="chk" />Disable button on first click
</form>
</body>
</html>
My cs code
using System;
public partial class _Default : System.Web.UI.Page
{
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
btn.Click += new EventHandler(btn_Click);
btn.OnClientClick = "btn_onClick();";
}
void btn_Click(object sender, EventArgs e)
{
lit.Text = DateTime.Now.ToString("HH:mm:ss");
}
}
Notice that when you click the button, a postback occurs, and the time is updated. But when you check the check box, the next time you click the button, the button is disabled (as expected), but never does the postback.
WHAT THE HECK AM I MISSING HERE???
Thanks in advance.
is there any way to use custom border by css or can make by JavaScript or jquery.
i want to use a different style of border.
like we use
border-style:dashed;
I was wondering if PHPStorm by Jetbrains has a tool to sort the methods in my JavaScript object by name. If not are there any other tools that can do this for me?
Ext.regController("dashboard", {
goToShoppingCart:function() {
Ext.dispatch({
controller:"shoppingCart",
action:"loadCart"
});
},
goToDashboard:function() {},
goToContact:function() {}
}
);
to
Ext.regController("dashboard", {
goToContact:function() {},
goToDashboard:function() {},
goToShoppingCart:function() {
Ext.dispatch({
controller:"shoppingCart",
action:"loadCart"
});
}
}
);
This is only for organization.
Thanks