I have a function to return points along a line and my return comes back with two decimal points...? For example, a return of my variable px will be something like -88.4029.032940598.
vx is the x vector and mult is the distance of the line plus distance to calculate the point.
Here is the operation that is returning these values:
var mult = parseFloat(mag + theUnit);
var px = coord_one.x_point + (vx * mult);
console.log(px);
Never have seen this before- I appreciate any and all help!
I have the following javascript:
$.post("/Authenticated/DeletePage/" + PageId);
showStatus("Page deleted...", 10000);
I would like to instead pass showStatus() text that is returned by the $.post() call, rather than hardcoded text. How do I do this?
On this page
http://zenchan.com/program/
When I rollover the right box 2nd from the top suddenly the overlapping (negative margin disappears). What's happening is that a 'hover' class is being added to shift the background sprite.
The two yellow boxes are debugging: if the hover class is put their in advance there is no problem. So fundamentally the CSS is not a problem for IE7 but adding the class is.
Any ideas what's causing this. I've tried adding haslayout to various elements but to little effect.
i have an asp.net mvc website where i build up most of the page using C# for example building up html tables given a set of data from my viewmodel
i also have a lot of javascript that then dynamcially modifies these tables (add row for example).
the javascript code to add a new row looks extremely similar to my "rendering" code i have in C# that is used to build up the html table in the first place.
Every time i change the c# code to a add a new field, i have to remember to go back to the javascript code to do the same.
is there a better way here?
I was wondering if there is a way to do an effect similar to this, except that instead of using images, I would use custom divs? I tried, replacing the img tag in that page to a div tag but it stops working. Any suggestions?
I have a form that once you select from a drop-down list and select submit, it is suppose to open up to a new window
Here is the code that is currently on the page and I think it needs to be completely wiped out or revised, it only works in IE and Firefox
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
//<!-- Hide JavaScript from older browsers
// Function to open a window
function windowOpen(window_url) {
helpWin = window.open(window_url,'','toolbar=yes,status=no,scrollbars=yes,menubar=yes,resizable=yes,directories=no,location=no,width=350,height=400');
if (document.images) {
if (helpWin) helpWin.focus()
}
}
// End script hiding -->
</SCRIPT>
I have the following mark up.
<ul>
<li><a><span>link-1</span></a></li>
<li><a><span>link-2</span></a></li>
<li><a><span>link-3</span></a></li>
</ul>
When user hover on the first 'a' then the next a tag in LI , we remove the backgorund-image.
I hope you are clear what I want to do with this.
Does anyone know an easy way to hide hashtags in the user's address bar? I am using a image gallery plugin and the only way to control the start position is to use a hash tag.
The problem is the hash tag gives away the relative path of the images folder and it looks bad.
Without the hash tag it only loads thumbs and not start image so really it's unavoidable.
Thanks!
I have a website template where I do not know the number of menu items or the size of the menu items that will be required. The js below works exactly the way I want it to, however this is the most js I've every written. Are there any disadvantages or potential problems with this method that I'm not aware of because I'm a js beginner? I'm currently manually setting the padding for each site. Thank you!
var width_of_text = 0;
var number_of_li = 0;
// measure the width of each <li> and add it to the total with, increment li counter
$('li').each(function() {
width_of_text += $(this).width();
number_of_li++;
});
// calculate the space between <li>'s so the space is equal
var padding = Math.floor((900 - width_of_text)/(number_of_li - 1));
// add the padding the all but the first <li>
$('li').each(function(index) {
if (index !== 0)
{
$(this).css("padding-left", padding);
}
});
I am having a web form initially which have href as follows
<a href="downloadInfo.aspx">ACH File Management System Trail(msi)</a>
<a href="downloadInfo.aspx">ACH File Management System Trail(zip)</a>
These are my two anchor tags when i click on this i will redirect both to a same page where user has to fill details and a mail will be send to the user for the given mail id. When the user clicks on mail i would like to have the download for which he opted to download. If msi means i would like to prompt msi file to be downloaded and if zip it should be downloaded
I need this to be worked with out using query-string
hi guys im developing in my own website.every thing works fine.i want to know if i clicks the any one of the radio button that value change correspondingly.can any one please post some code i tried this below code. my website is http:spsmobile.co.uk just check the link
in this page u just go to phone unlock and click make payment you will see the radio button named pay delivery methods
thanks in adv
var total = parseInt($("div.total-text").text().substring(1), 10);
$("input[name='rmr']").bind('change', function () {
var amount = 0;
switch (this.value) {
case "1":
amount = 3;
break;
case "2":
amount = 5.5;
break;
case "4":
amount = 10;
break;
}
$("div.total-text").text("£" + (total + amount));
});
});
$(document).ready(function () {
$('#primary').bind('change', function () {
$.ajax({
type: "POST",
url: "include/unlock_function.php",
data: $(this).is(':checked'),
success: function (theresponse) {}
}
}
};
}
}:
I'm doing something similar to close caption but not exactly the same. I have a youtube video, and I want to display certain messages at specific points in the video.
When the video loads, I pull entries from the database in the format time and sentence. For example, at 0:20 the speaker says "don't forget to write down my email that you see on the side" and I want to display the email on the side. At 0:50, he says "and I'll post my office hours" so I want to show those office hours at that time.
How can I do this. The video itself is hosted on youtube, but is being displayed on a private website. The div where I want to display the messages is <div id="write">.
I am using the window.location.search parameters (www.mysite.com?page=1) to direct the user to a specific page within the site. However, since those parameters are still in window.location (the browser) reset button continues to re-direct to the same page. I would like the reset button to re-direct to www.mysite.com
How do I clear the .search parameters so the (browser) reset button re-directs where I want? Is it done after the page is loaded? or after the (browser) reset button has been clicked?
I have two types of strings as the IDs of elements in my HTML markup:
Dates:
"april-23"
"march-20"
and season names:
"springtime"
"winter"
The dates have a dash separating the month and the day.
The seasons are a single word with no other tokens.
I want to assign the month or the season to a new variable called:
time_of_year
If I do this:
var time_of_year = $(this).attr("id").split('-')[0];
It will work on the months but if I call it on a season name which does not contain the token, will it generate an error?
What's the safe way to do this?
I have writed à checking/unchecking input code that works well in the fisrt loading of the page, but since I add an input via ajax then reload the inputs with the new input, the checking/unchecking event no longer works, I wonder what's the problem.
thanks before
I have a button on my web page that toggles the menu, After a postback the menu comes back despite me updating a hidden field value to store its state. Am I doing something wrong here? If there is a better way of doing it, let me know!
Markup:
<asp:Button ID="btnMenu" runat="server" Text="Hide Menu" UseSubmitBehavior="False"
OnClientClick="return toggleMenu(this);" />
<asp:Panel runat="server" ID="pnlMenuToggle">
//Main Menu
</asp:Panel>
<asp:Panel runat="server" ID="pnlSubMenuToggle">
//Sub Menu
</asp:Panel>
<asp:HiddenField ID="hfMenuState" runat="server" Value="true" />
<script>
//Toggles menu visibility
function toggleMenu(menuButton) {
var menuVisible = $('#<%=hfMenuState.ClientID%>').val() == 'true' ? true : false;
$('#<%=pnlMenuToggle.ClientID%>').slideToggleWidth();
$('#<%=pnlSubMenuToggle.ClientID%>').slideToggle('slow');
//Update whether the menu is visible
menuVisible = !menuVisible;
//Update menu button text
$(menuButton).val(menuVisible ? 'Hide Menu' : 'Show Menu');
$('#<%=hfMenuState.ClientID%>').val(menuVisible)
return false;
}
</script>
Code Behind:
(Page Load)
bool menu = Convert.ToBoolean( hfMenuState.Value );
pnlMenuToggle.Visible = menu;
pnlSubMenuToggle.Visible = menu;
The javascripts updates the hidden field value but it looks like this is never posted back to the server.
What can I do to make sure the menu stays hidden after postbacks.
I have also tried putting the hidden field in an Update Panel with Update Mode set to Always
Hi,
I have an address control which display the contact info of the person.
so it displays something like
1234, street
City, CA 12345
Now i want to give user flexibility to create format out of it.
For ex someone might want to display address as,
street, City, Country
OR
Just display their emails:
[email protected][email protected]
Any good ideas on how to it or similar examples?
thanks
I am using javascript to populate data in a table which return everything fine. I would like to make a string bold. See code below
$tr.find('.data').val($('#txtName').val() + ' <strong>Address:<\/strong> ' + $('#txtAddress').val());
How do I make only the word "Address" bold?
i'm try to change an image's imageurl on an aspx asp.net c# page based on a variable from #var=1 (or 2, or 3, or 4)
i know nothing about javascript unfortunately which is what i've been told i need. can anyone point me at a novice based script i can try to learn via implementation?
Could I somehow disable action (send, redirect) from submit if the textarea was empty (so nothing at all happens onclick). I want to avoid displaying error here, thats why I'm asking.
My textarea:
<textarea id="message" name="message" maxlength="35"></textarea>
My submit button:
<input id="send" type="image" src="/site_media/static/images/submit.png" value="Submit">
This is what i tried: http://jsfiddle.net/5Xwyb/
My brain died couple of hours ago.
In my spelling game there is a grid that is populated with words. The words are hidden and the aim of the game is to spell the word that is highlighted with the aid of a sound and a picture.
To highlight a word you press the "next" button. At the moment if you spell the word correctly it says "well done" and you can advance to the next word, but if you spell it incorrectly you have to keep attempting the word until it is complete.
As the game is designed for children I do not think this is the best approach, so I would like to make it so you can advance after 3 incorrect attempts.
I have played around with the script so much trying to put counters on incorrect attempts and then making the button active but cannot seem to get it to work. Can someone please help me?
Here is the script for the button
var noExist = $('td[data-word=' + listOfWords[rndWord].name + ']').hasClass('wordglow2');
if (noExist) {
$('.minibutton').click();
} else {
$('.minibutton').click('disable');
$("#mysoundclip").attr('src', listOfWords[rndWord].audio);
audio.play();
$("#mypic").attr('src', listOfWords[rndWord].pic);
pic.show();
}
});
"wordglow2" is the style applied if the word is spelt correctly. Here is a fiddle to help understand... http://jsfiddle.net/smilburn/ZAfVZ/4/
How do i find dynamic average for not the 20 input boxes with ".num" class but even just five out of 20. I have done it as below but it won't work
$.fn.sumValues = function() {
var sum = 0;
this.each(function() {
if ( $(this).is(':input') ) {
var val = $(this).val();
} else {
var val = $(this).text();
}
sum += parseFloat( ('0' + val).replace(/[^0-9-\.]/g, ''), 10 );
});
return sum.toFixed(2);
};
$(document).ready(function() {
$('input.price').bind('keyup', function() {
$('span.total').html( $('input.price').sumValues()/$('.num').length );
});
});
I have a jqgrid plugin which I call via Ajax. I have index.php and a getGridData.php. How will I pass form input in getGridData.php via ajax and use it in getGridData.php? I tried serialize but I can't pass or access it on getGridData.php. I need it as parameters for mysql. Here's my code.
<script language="javascript" type="text/javascript">
function jgGrid()
{
$(document).ready(function () {
$("#grid").jqGrid({
url: "inc/Controller/getGridData.php"+$("#thisForm").serialize(),
data : formData,
datatype: "json",
mtype: "POST",
colNames: ["SiteID", "TerminalID", "TransactionType", "Amount", "ServiceStatus"],
colModel: [
{ name: "SiteID"},
{ name: "TerminalID"},
{ name: "TransactionType"},
{ name: "Amount"},
{ name: "ServiceStatus"},
],
pager: "#pager",
rowNum: 10,
rowList: [10,20],
sortname: "SiteID",
sortorder: "asc",
height: 'auto',
viewrecords: true,
gridview: true,
caption: ""
});
});
}
</script>
getGridData.php
include('../Model/Queries.php');
$cardnumber = $_POST['cardnumber'];
$transact_type = $_POST['transact_type'];
$fromdate = $_POST['fromdate'];
$todate = $_POST['todate'];
$loyalty = new Queries();
$get_mid = $loyalty->loyaltyConn($cardnumber);
$somedata = json_encode($loyalty->nposConn($get_mid, $transact_type, $fromdate, $todate));
echo $somedata;