 |
 |
Hi...
I am creating web application using Netbeans and Mysql .
I created page to Save, Update & Delete marathi or hindi Language data to my database ... but facing problem with page and database for insert and view data
if i save तुषार ,,,,
database showing me तà¥à¤·à¤¾à¤°
Please help me
|
|
|
|
 |
Experts,
Can someone please help me resolve this problem?
When a user selects start time and end time, if the difference in hours is not at least 4 hours, an alert should be raised.
This works beautifully with asp.net web form.
However, I had to switch to Gridview because I wanted not just the ability to dynamically add more dates as needed, but also be able to submit user's choices to the database.
So, since switching to gridview, the validation is no longer working.
Can someone please give me a helping hand?
Thanks a lot in advance.
<script type="text/javascript">
$(function () {
$("[id$=txtdate]").datepicker({
showOn: 'button',
buttonImageOnly: true,
buttonImage: 'images/20/calendar200.gif'
});
});
</script>
<script type='text/javascript'> $(window).load(function () {
$('#btnSave').on('click', function () {
var sHour = $('#startHour').val();
var sMinutes = $('#startMinutes').val();
var sAmPm = $('#startAmPm').val();
var eHour = $('#endHour').val();
var eMinutes = $('#endMinutes').val();
var eAmPm = $('#endAmPm').val();
var theDate = $('#txtdate').val()
var timeStart = new Date(theDate + ' ' + sHour + ':' + sMinutes + ' ' + sAmPm).getHours();
var timeEnd = new Date(theDate + ' ' + eHour + ':' + eMinutes + ' ' + eAmPm).getHours();
var hourDiff = timeEnd - timeStart;
if (hourDiff < 4) {
alert("A mininum of 4 hours is required!");
}
});
});
</script>
Then markup
<asp:gridview ID="Gridview1" runat="server" OnRowDeleting="Gridview1_RowDeleting" ShowFooter="true" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="RowNumber" HeaderText="Row Number" />
<asp:TemplateField HeaderText="Event Date(s)">
<ItemTemplate>
<asp:TextBox ID="txtdate" runat="server" class = "Calender"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtdate"
ErrorMessage="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Start Time">
<ItemTemplate>
<asp:DropDownList id="startHour" runat="server">
<asp:ListItem Value="07">07</asp:ListItem>
<asp:ListItem Value="08">08</asp:ListItem>
<asp:ListItem Value="09">09</asp:ListItem>
<asp:ListItem Value="10">10</asp:ListItem>
<asp:ListItem Value="11">11</asp:ListItem>
<asp:ListItem Selected="True" Value="12">12</asp:ListItem>
<asp:ListItem Value="01">01</asp:ListItem>
<asp:ListItem Value="02">02</asp:ListItem>
<asp:ListItem Value="03">03</asp:ListItem>
<asp:ListItem Value="04">04</asp:ListItem>
<asp:ListItem Value="05">05</asp:ListItem>
<asp:ListItem Value="06">06</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="startHour"
ErrorMessage="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Minutes">
<ItemTemplate>
<asp:DropDownList id="startMinutes" runat="server">
<asp:ListItem Value="00">00</asp:ListItem>
<asp:ListItem Value="15">15</asp:ListItem>
<asp:ListItem Value="30">30</asp:ListItem>
<asp:ListItem Value="45">45</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="startMinutes"
ErrorMessage="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="AM/PM">
<ItemTemplate>
<asp:DropDownList id="startAmPm" runat="server">
<asp:ListItem Value="AM">AM</asp:ListItem>
<asp:ListItem Value="PM">PM</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="startAmPm"
ErrorMessage="*"></asp:RequiredFieldValidator>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="End Time">
<ItemTemplate>
<asp:DropDownList id="endHour" runat="server">
<asp:ListItem Value="07">07</asp:ListItem>
<asp:ListItem Value="08">08</asp:ListItem>
<asp:ListItem Value="09">09</asp:ListItem>
<asp:ListItem Value="10">10</asp:ListItem>
<asp:ListItem Value="11">11</asp:ListItem>
<asp:ListItem Selected="True" Value="12">12</asp:ListItem>
<asp:ListItem Value="01">01</asp:ListItem>
<asp:ListItem Value="02">02</asp:ListItem>
<asp:ListItem Value="03">03</asp:ListItem>
<asp:ListItem Value="04">04</asp:ListItem>
<asp:ListItem Value="05">05</asp:ListItem>
<asp:ListItem Value="06">06</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="endHour"
ErrorMessage="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Minutes">
<ItemTemplate>
<asp:DropDownList id="endMinutes" runat="server" CSClass="fptextbox12">
<asp:ListItem Value="00">00</asp:ListItem>
<asp:ListItem Value="15">15</asp:ListItem>
<asp:ListItem Value="30">30</asp:ListItem>
<asp:ListItem Value="45">45</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="startMinutes"
ErrorMessage="*" InitialValue="Select"></asp:RequiredFieldValidator>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="AM/PM">
<ItemTemplate>
<asp:DropDownList id="endAmPm" runat="server">
<asp:ListItem Value="AM">AM</asp:ListItem>
<asp:ListItem Value="PM">PM</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="endAmPm"
ErrorMessage="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
</ItemTemplate>
<FooterStyle HorizontalAlign="Right" />
<FooterTemplate>
<asp:Button ID="ButtonAdd" runat="server" Text="Add Another Event" OnClick="ButtonAdd_Click" />
</FooterTemplate>
</asp:TemplateField>
<asp:CommandField ShowDeleteButton="True" />
</Columns>
<FooterStyle BackColor="#AC54AA" Font-Bold="True" ForeColor="white" />
<RowStyle BackColor="#EFF3FB" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#AC54AA" Font-Bold="True" ForeColor="white" />
<AlternatingRowStyle BackColor="White" />
</asp:gridview>
</div>
<asp:Button ID="btnSave" runat="server" Text="Send Request" OnClick="btnSave_Click" alt="Send Request" />
<asp:Label ID="lblResult" style ="font-weight:bold; font-size:large" runat="server"></asp:Label>
<asp:Button ID="btnSave" runat="server" Text="Send Reservation Request" OnClick="btnSave_Click" alt="Send Request" />
modified 2 days ago.
|
|
|
|
 |
Since you now have multiple rows, you won't have an element with the ID startHour / startMinutes / etc. - they'll all have a row prefix to ensure that they get a unique ID.
Your current validation method won't actually do any validation. It will display an alert, but then allow the post to continue anyway.
Also, you probably don't want an alert for every row with an error. It would be better to keep the UI consistent by using a proper validator control. In this case, the CustomValidator control[^] is probably the best choice.
<asp:TemplateField HeaderText="End Time">
<ItemTemplate>
<asp:DropDownList id="endHour" runat="server">
...
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ControlToValidate="endHour"
ErrorMessage="*"
SetFocusOnError="True"
/>
<asp:CustomValidator ID="CustomValidator1" runat="server"
ControlToValidate="endHour"
ErrorMessage="A minimum of four hours is required."
Text="*"
SetFocusOnError="True"
OnServerValidate="ValidateDuration"
ClientValidationFunction="validateDuration"
/>
</ItemTemplate>
</asp:TemplateField>
protected void ValidateDuration(object sender, ServerValidateEventArgs args)
{
Control validator = (Control)sender;
Control row = validator.NamingContainer;
int startHour = int.Parse(((DropDownList)row.FindControl("startHour")).SelectedValue);
int startMinutes = int.Parse(((DropDownList)row.FindControl("startMinutes")).SelectedValue);
string startAmPm = ((DropDownList)row.FindControl("startAmPm")).SelectedValue;
switch (startAmPm)
{
case "AM":
{
if (startHour == 12)
{
startHour = 0;
}
break;
}
case "PM":
{
if (startHour != 12)
{
startHour += 12;
}
break;
}
default:
{
args.IsValid = true;
return;
}
}
int endHour = int.Parse(((DropDownList)row.FindControl("endHour")).SelectedValue);
int endMinutes = int.Parse(((DropDownList)row.FindControl("endMinutes")).SelectedValue);
string endAmPm = ((DropDownList)row.FindControl("endAmPm")).SelectedValue;
switch (endAmPm)
{
case "AM":
{
if (endHour == 12)
{
endHour = 0;
}
break;
}
case "PM":
{
if (endHour != 12)
{
endHour += 12;
}
break;
}
default:
{
args.IsValid = true;
return;
}
}
int hourDiff = endHour - startHour;
if (endMinutes < startMinutes)
{
hourDiff--;
}
args.IsValid = hourDiff >= 4;
}
function validateDuration(sender, args){
var row = $(sender).closest("tr");
var startHour = parseInt(row.find("select[name$=startHour]").val(), 10);
var startMinutes = parseInt(row.find("select[name$=startMinutes]").val(), 10);
var startAmPm = row.find("select[name$=startAmPm]").val();
switch (startAmPm) {
case "AM": {
if (startHour === 12) {
startHour = 0;
}
break;
}
case "PM": {
if (startHour !== 12) {
startHour += 12;
}
break;
}
default: {
args.IsValid = true;
return;
}
}
var endHour = parseInt(row.find("select[name$=endHour]").val(), 10);
var endMinutes = parseInt(row.find("select[name$=endMinutes]").val(), 10);
var endAmPm = row.find("select[name$=endAmPm]").val();
switch (endAmPm) {
case "AM": {
if (endHour === 12) {
endHour = 0;
}
break;
}
case "PM": {
if (endHour !== 12) {
endHour += 12;
}
break;
}
default: {
args.IsValid = true;
return;
}
}
int hourDiff = endHour - startHour;
if (endMinutes < startMinutes) {
hourDiff--;
}
args.IsValid = hourDiff >= 4;
}
NB: Your original validation function would consider 1:45 PM to 2:00 PM as one hour. This version will take the minutes into account as well. If that's not what you want, then you can remove the entire if (endMinutes < startMinutes) { ... } block, and the code which retrieves the startMinutes and endMinutes values.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
 |
WOW, Thank you so much Richard!
You gave me so much and I am truly grateful for your generosity.
I have a couple of questions I am afraid to ask but have no choice anyway.
The js that checks for minimum hours needed is giving me the following error:
Error: Object doesn't support property or method 'parseInt'
I believe that is a Javascript.
Thank you, thank again.
|
|
|
|
 |
Whoops! Looks like Number.parseInt [^] only works in Firefox. Try using just parseInt [^] instead, without the Number. prefix.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
 |
The error is gone but the validation is not working. I tried both IE and FF.
When I say not working, it just doesn't do anything.
Rather, bypasses the validation and submits to the db anyway.
|
|
|
|
 |
Do you have both the server and client-side validation in place?
Are you getting any script errors from the client-side validation?
And how are you posting to the database?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
 |
Yes, I have both server and client scripts in place.
I had to convert the server code to vb.net since that's what the rest of code is written in.
No errors from the Javascript.
I have a btnSave_Click sub. My thinking ( and I could be wrong) is that when user clicks the btnSave_Click to submit to the database but if minimum hour is not up to 4 hours, then the error is raised from your code.
Hope that's the way it should be done.
Thanks sir for your continued assistance and patience.
UPDATE: Now that I think about it, I *THINK* I know what the problem is.
Before your code, the validation included date:
var theDate = $("table[id*=Gridview1] input[id*=txtdate]").val();
var timeStart = new Date(theDate + ' ' + sHour + ':' + sMinutes + ' ' + sAmPm).getHours();
var timeEnd = new Date(theDate + ' ' + eHour + ':' + eMinutes + ' ' + eAmPm).getHours();
And also based on button click:
$('#btnSave').on('click', function () {
I am not sure how to reconcile these with your nice code Richard.
modified 2 days ago.
|
|
|
|
 |
OK, there were a few typos in my post, which should now be corrected:
- Missing "f" from
hourDiff within the if (endMinutes < startMinutes) block;
- Missing
break statements from the switch clauses;
- jQuery selectors should be
select[name$=...] instead of select[id$=...] due to changes in ASP.NET 4.0 ID generation;
I've updated my post with the Javascript code which should now work. The VB.NET code should look something like this:
Protected Sub ValidateDuration(ByVal sender As Object, ByVal args As ServerValidateEventArgs)
Dim validator As Control = DirectCast(sender, Control)
Dim row As Control = validator.NamingContainer
Dim startHour As Integer = Integer.Parse(DirectCast(row.FindControl("startHour"), DropDownList).SelectedValue)
Dim startMinutes As Integer = Integer.Parse(DirectCast(row.FindControl("startMinutes"), DropDownList).SelectedValue)
Dim startAmPm As String = DirectCast(row.FindControl("startAmPm"), DropDownList).SelectedValue
Select Case startAmPm
Case "AM"
If startHour = 12 Then
startHour = 0
End If
Case "PM"
If startHour <> 12 Then
startHour += 12
End If
Case Else
args.IsValid = True
Return
End Select
Dim endHour As Integer = Integer.Parse(DirectCast(row.FindControl("endHour"), DropDownList).SelectedValue)
Dim endMinutes As Integer = Integer.Parse(DirectCast(row.FindControl("endMinutes"), DropDownList).SelectedValue)
Dim endAmPm As String = DirectCast(row.FindControl("endAmPm"), DropDownList).SelectedValue
Select Case endAmPm
Case "AM"
If endHour = 12 Then
endHour = 0
End If
Case "PM"
If endHour <> 12 Then
endHour += 12
End If
Case Else
args.IsValid = True
Return
End Select
Dim hourDiff As Integer = endHour - startHour
If endMinutes < startMinutes Then
hourDiff -= 1
End If
args.IsValid = hourDiff >= 4
End Sub
The validator won't raise an error. Instead, as with any other validator control, the Page.IsValid property will return False . So your update method should look something like:
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSave.Click
If Page.IsValid Then
End If
End Sub
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
 |
Simply elegant Richard!
I now completely understand exactly what you did.
If minimum hour is less than 4, then the red asterick (*) is displayed.
It is working beautiful!
You have bailed me out again. Thank you soooo much, Richard.
I have got to figure out again, once more how to give you credit for the great work and then treat this thread as solved.
|
|
|
|
 |
Read here to understand how element id created inside an ASP.NET template...
Understanding ASP.NET Templates[^]
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
 |
does anyone know how to check whether someone is a fan of a facebook page.
|
|
|
|
 |
<?php require_once('Connect/Connect.php'); ?>
<!DOCTYPE html>
<html>
<head>
<script src="//maps.googleapis.com/maps/api/js?sensor=false"type="text/javascript"></script>
<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<style type="text/css">
html, body, #map-canvas {
height: 100%;
margin: 0;
}
</style>
<script type="text/javascript">
<?php
$sqlgps = "select * from gps ORDER BY id DESC LIMIT 1";
$result = mysql_query($sqlgps) or exit($sqlgps);
$row = mysql_fetch_array($result);
?>
var map;
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(<?php echo($row[latitude]) ?>, <?php echo($row[longitude]) ?>),
zoom: 17,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
}
function make(){
var marker = new google.maps.Marker({
position: new google.maps.LatLng(<?php echo($row[latitude]) ?>, <?php echo($row[longitude]) ?>), draggable:true, animation:google.maps.Animation.DROP,
map: map,
title: "Welcome to Thailand",
});
}
google.maps.event.addDomListener(window, 'load', initialize);
window.onload = make;
</script>
</head>
<body ">
<div id="map-canvas"></div>
</body>
</html>
|
|
|
|
 |
I want to know what is the main purpose of the angular js can u axplain with any live example in asp.net
thanx
|
|
|
|
 |
Ever considered to visit here: https://angularjs.org/[^]?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
 |
AngularJS is a MVC framework for client-side. You can use it for building an Single Page Application easily.
|
|
|
|
 |
I have the below code, I want to display Temprature -> Metric value ?
[
{
LocalObservationDateTime: "2014-06-30T11:40:00+05:30",
EpochTime: 1404108600,
WeatherText: "Mostly cloudy",
WeatherIcon: 6,
IsDayTime: true,
Temperature: {
Metric: {
Value: 18.6,
Unit: "C",
UnitType: 17
},
Imperial: {
Value: 66,
Unit: "F",
UnitType: 18
}
},
MobileLink: "http://m.accuweather.com/en/in/kodaikanal/195980/current-weather/195980",
Link: "http://www.accuweather.com/en/in/kodaikanal/195980/current-weather/195980"
}
]
|
|
|
|
 |
If you have that in a variable called "data", then this is how you could access it:
var value = data[0]['Temperature']['Metric']['Value'];
Or this way:
var value = data[0].Temperature.Metric.Value;
If you're not certain that these elements exist you should check before trying to access them, otherwise you will get a type error: Cannot read property '...' of undefined .
|
|
|
|
 |
Hi,
I have a strange behavior:
I have a collection of shapes that each one of them has a mouseover and mouseout event handlers.
When the user moves across a shape, its color changes and then when he moves out of it, its color returns to the original color.
The thing that I don't understand is sometimes, the mouseout event isn't trigering at all and the color of the shape remains with the hovered state.
Here's a fiddle I created just to demonstrate the problem. The mouseout sometimes doesn't run and so the color doesn't return to its normal red.
jsfiddle.net/aK5Cz
I even tried adding a global variable as the last element hovered and checking it but no luck...
Any ideas?
modified 29-Jun-14 7:44am.
|
|
|
|
 |
I think the problem that I can see is that even though addEventListener is called and executed, the handler doesn't execute.
You can see from the console log that it reaches the end of the mouseOver function but never the less the handler doesn't execute.
|
|
|
|
 |
You code looks extremely complicated for a simple mouseOver test... I can't see what the logic behind detach/attach the event handler every time. It also possible that because of the complexity of your code it takes too much time to handle one event so the second is wasted (JavaScript is single threaded!!!)...
First check your 'frame' code without complication, than add functionality bit-by-bit to check when problems start to show...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
 |
Thanks for your response Peter.
The code that you see is what needs to be there in order for the code to run.
I removed some of the stuff and changed some things but it doesn't matter.
I know that JS is single threaded. Maybe that could be the reason.
I will check it.
|
|
|
|
 |
I checked the code - it's the bare minimum I need for the mouse over\out so I don't have a lot to remove - although I removed parts.
http://jsfiddle.net/aK5Cz/3/[^]
What do you mean "I can't see what the logic behind detach/attach the event handler every time". There's no logic behind it - I just remove it. It's a built-in function.
The code sometimes reaches the end of mouseover and doesn't execute the mouseout when the cursor is out.
In case you are right about the thread issue: what are my alternatives?
|
|
|
|
 |
ThetaClear wrote: "I can't see what the logic behind detach/attach the event handler every time"
What I see that when you are int the mouseOver you detach it and attach mouseOut, in mouseOut you detach mouseOut and attach mouseOver. Why?! Attach both mouseOver and mouseOut once at the beginning...IMHO that's your main problem. You can see that you miss mouseOut when you move mouse too fast...So the thread can't keep up with you and drops events...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
 |
Ok.
I don't know if you had a chance of working with easeljs library but if I want to change the color of a certain shape i.e. my rectangle, I need to draw another rectangle and give it a different color and give it a handler for the mouseOut.
To do that, I need to remove the previous rectangle.
I can't just attach mouseOver and mouseOut once in the beginning because I'm removing and adding shapes all the time when the user hover on them so I have to add handlers to them.
Now, for your second remark:
Quote: You can see that you miss mouseOut when you move mouse too fast...So the thread can't keep up with you and drops events...
If that is the problem (moving too fast). how can I solve it?
|
|
|
|
 |
You have not recreate the shape to change its color, otherwise what use the library has?! Use graphics.beginFill and stage.update in the mouseOver too! Here a very nice sample of it - http://www.createjs.com/#!/EaselJS/demos/dragdrop[^]
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
 |
Read OP carefully - it's about changing the color of a shape on a HTML canvas! No CSS for that
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
 |
Right, well, this seems to work as requested:
var stage = null;
var sh = new createjs.Shape();
$(document).ready(function(){
var canvas = document.getElementsByTagName("canvas")[0];
var context = canvas.getContext("2d");
stage = new createjs.Stage(canvas);
// main stage surface
stage.enableMouseOver();
drawInitialShape();
});
function drawInitialShape(){
var cont = new createjs.Container();
stage.addChild(cont);
sh.graphics.beginFill('#FF0000').drawRoundRect(0, 0, 20, 20, 1.5);
sh.x = 150;
sh.y = 150;
cont.addChild(sh);
stage.addChild(cont);
sh.addEventListener('mouseover', function(e){
onSeatMouseOver(e);
});
sh.addEventListener('mouseout', function (e) {
onSeatMouseOut(e);
});
stage.update();
}
var onSeatMouseOver = function (e) {
$('body').css('cursor', 'pointer');
sh.graphics.beginFill('#dddddd').drawRoundRect(0, 0, 20, 20, 1.5);
stage.update();
}
var onSeatMouseOut = function (e) {
$('body').css('cursor', 'auto');
sh.graphics.beginFill('#FF0000').drawRoundRect(0, 0, 20, 20, 1.5);
stage.update();
}
|
|
|
|
 |
Exactly!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
 |
Great, it works!!!
Thanks guys!
|
|
|
|
 |
I have a code that works, but I need to find another way of writing the JS. The code has 1 image, but 4 mp3 for sounds. There are different dots on the image that when you click on the dots should be a different sound.
html part:
<html>
<head>
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<title>OdysseyWare</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="" ie="8">
<link href="/globmedia/ow/css/main_2012_12_12.css" rel="stylesheet">
<link href="/globmedia/ow/css/curric_2012_12_12.css" rel="stylesheet" type="text/css" media="screen">
<link href="/globmedia/lib/jquery-ui/css/jquery-ui-1.8.4.custom.css" rel="stylesheet" type="text/css">
<link href="/globmedia/lib/jquery/css/magnific-popup.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/globmedia/lib/jquery/js/jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript" src="/globmedia/lib/jquery-ui/js/jquery-ui-1.10.3.custom.js" type="text/javascript"></script>
<script type="text/javascript" src="/globmedia/lib/requirejs/js/require.js" type="text/javascript"></script>
</head>
<body id="body">
<div id="section_0" style="margin: 0px auto; width: 970px">
<div class="presentation">
<presentation>
<div class="section">
<h3>Test 1 New</h3></div>
<p>However, the introduction and conclusion to “The Way to Wealth” show that the author’s
advice is presented in a somewhat ironic way. While the crowd that has gathered to listen to
Father Abraham agrees with him until the “vendue,” or sale, begins, they forget the old man’s
and begin to “buy extravagantly.”</p>
<p style="TEXT-ALIGN: center">
<div id="test1" data-asset-basepath="media/html5" data-data-basepath="media/html5" data-media-basepath="/globmedia" data-am-controller="media/html5/test1/js/test1.js" style="border: 1px solid black; margin-right: auto; margin-left: auto;"></div>
</p>
</div>
</presentation>
</div>
</div>
<script type="text/javascript">
require.config({
baseUrl:'/globmedia'
});
</script>
<script type="text/javascript" src="/globmedia/html5/animationmanager/js/animationmanager.js"></script>
</body>
</html>
js part
(function(doc){
'use strict';
return function init(){
var _this = this;
require(['createjs','SimpleInteractiveAnimationModule', 'jquery'],function(c, _anm, jq){
var queue = [{id:_this.id + 'audio1',src: _this.assetBasePath + '/test1/media/roles-1_olderMen.mp3', type:'audio'},
{id:_this.id + 'audio2',src: _this.assetBasePath + '/test1/media/roles-1_youngMen.mp3', type:'audio'},
{id:_this.id + 'audio3',src: _this.assetBasePath + '/test1/media/roles-2_olderWomen.mp3', type:'audio'},
{id:_this.id + 'audio4',src: _this.assetBasePath + '/test1/media/roles-2_youngWomen.mp3', type:'audio'},
{id:_this.id + 'image1',src: _this.assetBasePath + '/test1/media/roles.png', type:'image'}];
var pointsNum = 4,
pointsArray = [],
pointColor = '#0040ff';
var pointsObject = {
point1:{
x:382,
y:102},
point2:{
x:146,
y:172},
point3:{
x:455,
y:102},
point4:{
x:312,
y:245},
};
var anm = _anm.getNewInstance();
anm.createSimpleInteraction({parentContainer:_this.element,
queue:queue,
copyright:'2009',
callback:setupClickPoints});
function setupClickPoints(){
for(var i = 0; i < pointsNum; i++)
{
var tempNum = i + 1;
var clickPointShape = new c.Shape();
clickPointShape.graphics.beginFill(pointColor).drawCircle(0,0,16).endFill();
var clickPoint = anm.createSimpleButton(clickPointShape, getClickPoint(i));
anm.updateContainer(clickPoint,{x:pointsObject['point' + tempNum].x,
y:pointsObject['point' + tempNum].y,
alpha:0.01});
pointsArray.push(clickPoint);
}
}
function getClickPoint(audioIndex){
return function(event){
anm.playAudio(audioIndex);
};
}
});
};
}(document));
I just need a different JS code.
Thank you
|
|
|
|
|
 |
I using devextreme to develop mobile apps to call my web method wrote in c#. It is success call the web method but the data return is all html source code. I has enable the cross origin in the IIS for the web service.
Below is the jquery get i use to call the web method.
$.get('http://192.168.2.104:81/TwinCatWebServices.aspx/writetempo2', {
btempo2: "'" + viewModel.btempo + "'" }).done(function (result) {
//result is your data
alert("success");
console.log(result);
})
.error(function (result) {
alert(result);
console.log(result);
})
my web method as below
[WebMethod]
public static string writetempo2(string btempo2)
{
string test = "ABC";
return test;
}
I try this as well but also the same
[WebMethod]
public static string writetempo2(string btempo2)
{
string test = "ABC";
var oseries = new System.Web.Script.Serialization.JavaScriptSerializer();
return oseries.Serialize(test);
}
In the browser console, i saw the return result as below:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
</title></head>
<body>
<form method="post" action="writetempo2?btempo2=%27true%27" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="zTMjjnpAKtBaBVL8P2JeyNhoLSPcdk68uxF2AbXAU31Qqyfd/
EvogsxQHknxMsghbF9k1bnXDwsxk9A5rVojBH6vLrHV1f4/eOz1OKbEXno=" />
AAAAAA
</form>
</body>
</html>
What the mistake I make. Please help.
|
|
|
|
 |
Greetings Experts,
I have the following javascript:
<script type="text/javascript">
$(document).ready(function () {
$( buttonImage: buttonImageOnly: true, onSelect: function (dateText, inst) {
//Calculate the days here
var days = ($("#txtToDate").datepicker( //Assign it to textbox
$( },
onClose: function () { $(this).focus(); }
});
$( buttonImage: buttonImageOnly: true, onSelect:
function (dateText, inst) {
$( }
,
onClose: function () { $(this).focus(); }
});
});
</script>
<script type='text/javascript'> $(window).load(function () {
$('#Button1').on('click', function () {
var sHour = $('#startHour').val(),
eHour = $('#endHour').val();
var timeStart = new Date(txtFromDate + sHour).getHours();
var timeEnd = new Date(txtToDate + eHour).getHours();
var hourDiff = timeEnd - timeStart;
if (hourDiff <= 2) {
alert("A mininum of 2 hours per reservation is required!");
}
});
});
</script>
<asp:TextBox ID="txtFromDate" class="fptextbox12" placeholder="MM/DD/YYYY" runat="server" style="width:160px;"></asp:TextBox>
<asp:TextBox ID="txtToDate" class="fptextbox12" placeholder="MM/DD/YYYY" runat="server" style="width:160px;"></asp:TextBox>
The top part of Javascript is used for our datepicker functionality.
A user selects a startdate and an enddate and the total number of days between the startdate and enddate are stored in a control ID called numOfDays.
This works fine.
The second part of the javascript is where I am having issues.
A user selects start time and end time.
If the difference between starttime and endtime is not up to atleast 2 hours, the user is notified that a minimum of two hours is required.
The issue is that I am trying to store the value of startDate and endDate in the two lines below and append time to them but this not working:
var timeStart = new Date(txtFromDate + sHour).getHours();
var timeEnd = new Date(txtToDate + eHour).getHours();
Any ideas what I am doing wrong?
|
|
|
|
 |
Hi, samflex, you check if the values
var timeStart = new Date(txtFromDate + sHour).getHours();
var timeEnd = new Date(txtToDate + eHour).getHours();
have the correct value?? Futhermore you need be carefully with the behavior of dropdownlist
Regarts
|
|
|
|
 |
Hi Pablo,
Thanks for the prompt response.
What you just posted is what I have though. What am I missing?
Just to explain further, when you select a date value from the datepicker, say for instance, the FromDate, it goes into the control below:
<asp:TextBox ID="txtToDate" class="fptextbox12" placeholder="MM/DD/YYYY" runat="server" style="width:160px;"></asp:TextBox>
What I am trying to do is grab that value and stick it into this:
var timeStart = new Date(txtFromDate + sHour).getHours()
This way, if I select start time of 12:00PM, it should show something like:
06/24/2014 12:00PM.
Same goes with txtToDate. Am I not doing it correctly?
|
|
|
|
|
|
 |
In GridView, one column is of checkboxes, I need that if any duplicate record is there for e.g. Name is duplicate and we check its checkbox then record of its duplicate name should also get checked.
|
|
|
|
 |
Hi, Lets assume that you want to do on Name so if check one checkbox with Name Ravi and there are 3 record with Name Ravi then all 3 checkbox should get checked, so you can do like below, lets say that you are having checkboxes <div id="mainGridDiv"> <input type="checkbox" value="<Name>"/> <input type="checkbox" value="<Name>"/> <input type="checkbox" value="<Name>"/> </div> JQuery Code $("#mainGridDiv input[type=checkbox]").change(function(){ var currValue = $(this).val(); $("#mainGridDiv input[type=checkbox]").find("[value='"+currValue+"']").attr("checked",$(this).checked) }); NOTE:Assuming checkbox is one column of your grid. Thanks Raviranjan
|
|
|
|
 |
Hello,
I am using regex to validate some patterns in javascript
My pattern is
[VF][0-9]
And required output is V1-V9 , F1-F9 in any order (eg:V1,V3,V2,F1,F5,F3) OR (eg: F1,F5,F3,V1,V3,V2)
But it is not working can any one help me?
Thanks and regards.
|
|
|
|
 |
You question is not clear. The regex provided will check if the string has an V or F (case sensitive) at the first position and then a digit (0-9).
But the part of the 'required output' is confusing! What the input, what the output, what have you expected?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
 |
Hello,
My input is something like V1V2-V3-S-V4-F1
And I need to validate the given value contain any of V1 to V9 or F1 to F9 and S.
eg: if user input V20V30-V12-S10-V20-F10 I have to show a error because only 1-9 is allowed.
eg2: if user input R1R2-R3-S-R5-T6 I have to show a error because only V,S,F allowed
And it is not mandatory to enter V/F but S is mandatory.
I think it is clear now.
|
|
|
|
|
 |
when i use this code it doesnt work correctly :
<script type="text/javascript" src="includes/mootools.js"></script>
<script type="text/javascript" src="includes/ja_contentslide.js"></script>
<script>
jQuery.noConflict();
</script>
-->
<script type="text/javascript" src="slidshow/modernizr.js"></script>
<script type="text/javascript" src="slidshow/jquery_004.js"></script>
<script type="text/javascript" src="slidshow/jquery_006.js"></script>
|
|
|
|
 |
Member 9473809 wrote: doesnt work correctly It's a bit confusing. What does not work? There is an error? No error but the outcome is different from what you have expected?
In any way - from the piece of code here it seems that you use jQuery before including it!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
 |
function GetEqrDataUploadFiles()
{
var upload=$("#files").data("KendoUpload");
var s = upload.wrapper[0].childNodes[2].childNodes.length;
var a = new Array();
for (i = 0; i < s; i++)
{
if (document.all) {
a.push(upload.wrapper[0].childNodes[2].childNodes[i].innerText);
}
else {
a.push(upload.wrapper[0].childNodes[2].childNodes[i].textContent);
}
}
return a;
}
|
|
|
|
 |
This means that upload.wrapper[0] is null. You'll need to debug it to figure out why.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
 |
javascript Run Time Error[^]
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
 |