 |
 |
I can't figure out how to do the following with javascript:
- user enters a url for an html page e.g. Start.html
- on that html page there is link the user needs to click
When the user clicks that link I want to:
- reload the current browser window (NOT open new browser window or a new tab) with the url of some aspx page
- remove any browser related menus/buttons and the URL textbox.
Here is what I have in the html body:
Login
Here is the associated javascript:
function openClient() {
clientWindow = window.open('Login.aspx?p=1','_self','directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');
}
The part about loading the asp page in the same browser window works fine. The part that's not working is removing all the browser related buttons and the URL textbox. I can still see the URL textbox.
Can anyone please help?
thanks,
|
|
|
|
 |
You can't. If it was possible for script to hide the URL, menus and toolbars, every malicious site on the net would do it.
Even if you open the page in a new window, most browsers will still show the URL.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
 |
I have an old javascript that works in both IE and Firefox but it's for a new browser window, not a current one. So, there is no way to do it for the current browser window? What about by using css to hide it? Any way to disable it?
|
|
|
|
 |
Not without a browser extension installed on the system that you want to do this on.
It's a terrible idea, by the way.
|
|
|
|
 |
IE has a setting to show the address bar even with the code you have. So, the real answer is no, there is no way to ensure it. It will depend on which browser the user is using and what their settings are.
However, what you can do is create a div on your page that has all the same controls and then can easily display that using jquery ui's dialog feature. See Dialog | jQuery UI[^].
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
 |
am using the following code
$("#div_id").dialog({
title: "Enter your Password",
autoOpen: false,
height: 150,
width: 250,
modal: true,
show: 'drop',
hide: 'drop',
open: function() {
document.getElementById("<%=txt_password.ClientID %>").value = "";
},
buttons: {
"Confirm": function() {
debugger;
var password = document.getElementById("<%=txt_password.ClientID %>").value;
}
}
});
here after entering the text in text box of dialog box..i need to press tab or use the mouse to click confirm button..
my requirement is: After entering text in textbox ,just press the enter button ..how to focus the confirm button like that
here div_id:
<div id="div_password">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:Label ID="lblpassword" runat="server" Text="Password" Font-Bold="true" /></td>
modified 5 days ago.
|
|
|
|
|
 |
I have following row data in a json file:
{rows:[
{id:1,data:["1","A","10"]}
,{id:2,data:["2","B","50"]}
,{id:3,data:["3","C","60"]}
,{id:4,data:["4","D","70"]}
,{id:5,data:["5","E","90"]}
,{id:6,data:["6","F","2"]}
,{id:7,data:["7","G","4"]}
,{id:8,data:["8","H","50"]}
,{id:9,data:["9","B","100"]}
,{id:10,data:["10","A","60"]}
,{id:11,data:["11","K","0"]}
,{id:12,data:["12","L","20"]}
]}
I was wondering if I can get a kick start suggestion to write our own group by function to group on any column. Like in above example, we can use the second column to group by.
The only restriction I have is that I can't use jquery and have to use java script only.
Need expert help...
|
|
|
|
 |
You can overload the standard Array.sort() in the same manner as a standard comparative operation.
The problem that you have is that your rows are not properly formatted for JSON (it looks like your data value should be an object, not an array) and you're mixing strings and integers. If you ONLY want to group by 1 field that's easy, if you want flexibility then you'll have a more complicated operation on your hands. One sort function will not be suitable for your needs, since string comparisons in Javascript will give you wonky results when used on stringified numbers, and using numerical comparisons on strings will also give bad data.
Array.prototype.sort() - JavaScript | MDN[^] has a bunch of suggestions for how to handle sorting of various data types and uses vanilla Javascript.
|
|
|
|
 |
I have an AngularJS view that contains a ng-grid row cellTemplate icon button. The problem only happens in IE and not in Google Chrome. When the user selects the icon button a ngDialog is opened and on the dialog close event the dialog closes then the selected icon button increases in size in the cell and all of the text in that row shifts up and to the left. I have tested this in Google Chrome and the problem does not occur. What I am seeing is that the entire browser seems to do a shift to the right then back when I do close the dialog. It was recommended to me that on dialog close I close the dialog then redirect to a dummy view which redirects back to reload the view with ng-grid. I tried that but am unable to get working.
The dialog definition, and the cellTemplate markup the contains the icon button that calls the open dialog event is shown below along with the dialog open and close event
<script type="text/ng-template" id="ApproverCommentsDialog">
<div class="ngdialog-message">
<h3>Approver Comments</h3>
<p>
({ApproverComment}}
</p>
</div>
<div id="gridDiv" class="ngdialog-buttons">
<button type="button" ng-click="OKClicked()" class="ngdialog-button ngdialog-button-primary">OK</button>
</div>
</script>
var = cellTemplateIconWithTooltip = '<div class="ngCellText" ng-class="col.colIndex() - 1"><a title="Show" ng-click="displayComments(row.entity)"><img src="../../../../Content/images/managerequests.png" style="float: right; padding:5px; border:3px" height="20px" width="20px" /></a></div>';
$scope.displayComments = function (row) {
$scope.ApproverComment = row.ApproverComments;
ngDialog.open({
template: 'ApproverCommentsDialog',
className: 'ngdialog-theme-default',
data: row.ApproverComments,
scope: $scope
});
};
$scope.OKClicked = function () {
ngDialog.close();
};
Any help would be great.
modified 14-Mar-16 12:12pm.
|
|
|
|
 |
Angular is designed to operate completely on AJAX. If you find yourself doing post-backs as a workaround, something significant is wrong.
In this case, what your seeing sounds like a basic CSS issue.
In your local .css file add:
.ngdialog-theme-default{
overflow: auto !important;
}
I had a similar problem with bootstrap alerts that was resolved by adding an overflow handler to the alert class.
|
|
|
|
 |
i am quite new in angular and still learning. so just found today angular.bootstrap function it run ng code manually.
i do not understand what kind of angular js code we need to run manually by angular.bootstrap function and which code does not require angular.bootstrap function to run manually.
so just tell me what to look for in code to identify that code can run or we need to use angular.bootstrap function to run the code. please discuss with example. thanks
tbhattacharjee
|
|
|
|
 |
If you're just starting with Angular, you don't need this function. This is to load a different Angular application, which has some very specific use cases, but is not something you should worry about as yet.
The flow for getting Angular up in a page is:
- Add an ng-app attribute to the html tag
<html ng-app="myApp">
- Have a script file that defines myApp
angular.module('myApp',[]);
- Include the primary Angular script
- Include your script that defines 'myApp' (or have a script block that defines it, as below)
Here's a basic working sample:
<!DOCTYPE HTML>
<html ng-app="myApp">
<head>
<title>My Angular App</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
<script type="text/javascript">
angular.module('myApp',[])
.controller('myController',['$scope',function($scope){
$scope.title = 'Welcome to MyApp!';
}]);
</script>
</head>
<body ng-controller="myController">
<h2>
{{title}}
</h2>
</body>
</html>
|
|
|
|
 |
thanks for reply but my question was different.
i try to know that how do i know which angular code need to run with the help of angular.bootstrap function ?
some time angular code can run without the help of angular.bootstrap function and some time required the help from angular.bootstrap function.
so if i get any angular code then how do i detect that code need help angular.bootstrap function to run........would u discuss it.
thanks
tbhattacharjee
|
|
|
|
 |
I did answer that question, no Angular code REQUIRES angular.bootstrap.
If you've loaded your app via ng-app then you're good to go. If you did not give a tag the ng-app attribute, then you need it. All it does is load an application module, that's it. Your module should include its requirements as part of the Angular DI system, and unless you have a masochistic tendency there's no reason to separate the Angular structure from the HTML document(provided it's yours to manage).
When you might use it:
If you're injecting angular into a template that doesn't have a suitable place for an ng-app tag then you need it. If you're delivering an application via CDN and will not have control over the end usage, then you might need it. That's all I've got off the top of my head before my first cup of coffee.
|
|
|
|
 |
i gave you up vote for your explanation.
you said : When you might use it:
If you're injecting angular into a template that doesn't have a suitable place for an ng-app tag then you need it. If you're delivering an application via CDN and will not have control over the end usage, then you might need it. That's all I've got off the top of my head before my first cup of coffee.
it would be nice if you explain what u said above with code and example. i am new in angular so i may understand things with code and explanation. if possible please come with 3rd time for the same with some code which help me to understand when we need angular.bootstrap function and when angular.bootstrap function is not require to run the code. thanks a lot
tbhattacharjee
|
|
|
|
 |
Those aren't Angular-specific, just web development strategies. Here's my advice, don't use angular.bootstrap. Forget it exists, it'll only confuse you. Just attach ng-app to the html tag, it's much easier to learn using the framework in that manner.
The examples that I provided are more architectural than implementation, which is why there's not much point to sample code.
References:
Web template system[^]
Content delivery network[^]
|
|
|
|
 |
Please give me some solution for that.
Thank you
|
|
|
|
 |
tienich wrote: Please give me some solution for that. Study the software documentation for the device.
|
|
|
|
|
 |
If the hardware API happens to have a JavaScript interface then great!
If it does not, which would be the normal state of affairs, you'll need to build a middleware webservice that interfaces with the driver. Likely candidates for the middleware language are C-family or Java.
|
|
|
|
|
 |
The following is my js code which gives me database error alert as "undefined". Kindly give me suggestion
var db;
var dbCreated = false;
var scroll = new iScroll('wrapper', {
vScrollbar : false,
hScrollbar : false,
hScroll : false
});
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
var firstName = document.getElementById("usernamesignup").value;
var email = document.getElementById("emailsignup").value;
var password = document.getElementById("passwordsignup").value;
var conpassword = document.getElementById("passwordsignup_confirm").value;
//var password = document.getElementById("psw").value;
db = window.openDatabase("RegistrationDB", "1.0", "Registration", 200000);
/*if (dbCreated){
// alert("123");
}
else{*/
db.transaction(populateDB, transaction_error, populateDB_success);
}
function populateDB(tx) {
tx.executeSql('DROP TABLE IF EXISTS Registration');
var sql = "CREATE TABLE IF NOT EXISTS Registration ( "
+ "firstName VARCHAR(50), " + "email VARCHAR(50), "
+ "password VARCHAR(50), " + "conpassword VARCHAR(50))";
tx.executeSql(sql);
var firstName = document.getElementById("usernamesignup").value;
var email = document.getElementById("emailsignup").value;
var password = document.getElementById("passwordsignup").value;
var conpassword =document.getElementById("passwordsignup_confirm").value;
// var pwrd = document.getElementById("psw").value;
tx.executeSql("INSERT INTO Registration (firstName,email,password,conpassword) VALUES ('"+ usernamesignup +"','"+ emailsignup +"' , "+ passwordsignup+", '"+ passwordsignup_confirm+"' )");
}
function transaction_error(tx, error) {
alert("Database Error: " + error);
}
function populateDB_success() {
dbCreated = true;
// where you want to move
alert("Successfully inserted");
window.location="file:///android_asset/www/login.html";
}
|
|
|
|
|
|
 |
I have a ng-grid that I am trying create a wrap-text column for a column that contains multiple lines of comment text. I have been trying everything today that I can find on the internet and still can't find a solution. I want to show you my code and if someone can tell me a better way of doing this that would be a great help.
.gridStyle4 {
border: 1px solid #dfdfdf;
overflow-y: scroll;
}
<div style="margin-top:100px;">
<hr style="height:1px; background-color: silver; border:0px; margin-top:0px; margin-bottom:10px;" />
<div class="gridStyle4" ng-grid="gridOptions" />
<div class="pagination">
<ul>
<li ng-class="{disabled: currentPage == 1}">
<a ng-click="prevPage()">« Prev</a>
</li>
<li ng-repeat="n in range(GridPagingOptions.totalPages)" ng-class="{active: n == currentPage-1}" ng-click="setPage()"><a ng-bind="n + 1">1</a>
</li>
<li ng-class="{disabled: currentPage == GridPagingOptions.totalPages}">
<a ng-click="nextPage()">Next »</a>
</li>
</ul>
</div>
</div>
$scope.gridOptions = {
data: 'myData',
enablePaging: true,
pagingOptions: $scope.GridPagingOptions,
sortInfo: {
fields: [],
columns: [],
directions: []
},
useExternalSorting: false,
showFooter: false,
columnDefs: [{
field: 'RequestNumber',
width: 90,
displayName: 'RequestID'
}, {
field: 'ActionByName',
width: 160,
displayName: 'Action }, { field: '
ActionDate ', width: 90, displayName: Action Date',
cellFitlter: "date:'yyyy-MM-dd'"
}, {
field: 'Comments',
width: 125,
displayName: 'Comments'
}, {
field: 'ApproverComments',
displayName: 'Approver Comments',
rowHeight: 25,
width: 215,
cellClass: 'wrap-text',
cellTemplate: '<label id="approverC" name="approverC" title="{{ row.getProperty(col.field)}}">{{ row.getProperty(col.field)}}</label>'
}]
};
|
|
|
|
 |
I think I found an answer. I found out that someone used a textarea to do this but I still can't get it to work. Here is what I'm doing:
{ field: 'ApproverComments', enableCellEdit: false, width: 215, cellClass: 'wrap-text', cellTemplate: '<textarea ng-modle="ApproverComments"></textarea>' }
|
|
|
|
 |
Sorry,
In my last post I miss spelled model. Here is the correct code and it still only shows an empty editable textarea and not the model text.
{ field: 'ApproverComments', enableCellEdit: false, width: 215, cellClass: 'wrap-text', cellTemplate: '<textarea ng-model="ApproverComments"></textarea>' }
|
|
|
|
 |
We are using Viewer which load .jpeg file. Viewer is built by JavaScript Code. we are also using Rotation annotation but it is not working. below mention is the snippet of code.
Viewer.RotatePage = function() {
if(Viewer.CanRotate)
{
RealDocNo = Viewer.CurrentDocument - 1;
RealPageNo = Viewer.CurrentPage -1;
Viewer.Documents[RealDocNo].PageOrientation[RealPageNo] = Number(Viewer.Documents[RealDocNo].PageOrientation[RealPageNo]) +1;
if(Viewer.Documents[RealDocNo].PageOrientation[RealPageNo] == 4)
Viewer.Documents[RealDocNo].PageOrientation[RealPageNo] = 0;
document.getElementById("ThumbnailImage_"+Viewer.CurrentDocument+"_"+Viewer.CurrentPage).style.filter = "progid:DXImageTransform.Microsoft.BasicImage(rotation="+Viewer.Documents[RealDocNo].PageOrientation[RealPageNo]+")";
document.getElementById("PageImage_"+Viewer.CurrentDocument+"_"+Viewer.CurrentPage).style.filter = "progid:DXImageTransform.Microsoft.BasicImage(rotation="+Viewer.Documents[RealDocNo].PageOrientation[RealPageNo]+")";
if (js_HideAnnotations!="true") {
Viewer.LayoutAnnotations(Viewer.CurrentDocument);
Viewer.LayoutHilites(Viewer.CurrentDocument);
}
}
}
even we are not getting any error. please help us to resolve this issue.
|
|
|
|
 |
i have one doubt
If i click on One Hyperlink(one Html page) navigate to another Page(it contain Image map---want to helight perticular location)
is it possible in java script
give suggestion or any sample file
if possible both vice versa also required
|
|
|
|
|
 |
I am using canvas to draw concentric circles with clock over it, but i cant put my clock exactly over the center of circles!
|
|
|
|
 |
How come?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
 |
So I have this row that's a cart item. And inside the row are column divs with spans for values.
I manage to isolate the div row, and I'm trying to find the the spans and change the values.
I tried each, but it seems to grab all the elements, and not step through each one.
I'm stumped on this.
So my HTML looks like this, and I want to change the value of span data-qty attr and the inner html inside the span tag.
<div class="cartRecord" onclick="service_selectItem(17);" data-serviceid="1" data-cartid="17">
<div class="cartQty">
<span data-qty="7">7</span>
</div>
<div class="cartSKU" id="1000">
<span>1000</span> </div>
<div class="cartDescription">
<span>Diagnose and repair hardware or software</span>
</div>
<div class="cartPrice">
<span>95.00</span>
</div>
<div class="cartTotal">
<span data-total="665">665.00</span>
</div>
</div>
This is what I have going, if my thoughts are way off track I'm open to suggestions.
success: function (data) {
if (data !== null) {
var dRecord = $('div.cartRecord[data-cartID="' + _cartID + '"]');
if (dRecord !== null) {
dRecord.each(function(index, element) {
alert($(this).html());
if ($(this).is('span')) {
alert($(this).html());
if ($(this).attr('data-qty')) {
alert($(this).html());
$(this).data('data-qty', data.Qty).html(data.Qty);
}
}
if ($(this).is('span')) {
alert($(this).html());
if ($(this).attr('data-total')) {
alert($(this).html());
$(this).data('data-total', data.Total).html(data.Total);
}
}
});
}
}
|
|
|
|
 |
The each function iterates through all of the elements matched by the selector - ie: the div elements with the specified data attribute. It doesn't iterate over the descendants of the matched items, which is what you're trying to do.
You don't actually need to iterate over the descendants. You can just find the relevant span elements and update them directly:
var dRecord = $('div.cartRecord[data-cartID="' + _cartID + '"]');
dRecord.find("span[data-qty]").html(data.Qty).data("qty", data.Qty);
dRecord.find("span[data-total]").html(data.Total).data("total", data.Total);
Also worth noting that the return from the $ function will never be null . If there are no matching elements, you'll still get a jQuery object back, with a length of zero.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
 |
I feel stupid now. That's sort of how I found the the data I needed in another function.
very simple and elegant.
I didn't think of or forget about find.
I added the dRecord Check as length instead of null or undefined. Maybe I don't need it.
The data-qty and data-total didn't change, but I can figure that out.
success: function(data) {
if (data !== null) {
var dRecord = $('div.cartRecord[data-cartID="' + _cartID + '"]');
if (dRecord.length > 0) {
dRecord.find("span[data-qty]").html(data.Qty).data("data-qty", data.Qty);
dRecord.find("span[data-total]").html(data.Total.formatMoney(2, '.', ',')).data("data-total", data.Total);
}
} else {
$("#serviceUpdate").removeClass('btn btn-default').addClass('btn btn-danger');
}
}
Oh this MVC and the Twitter Bootstrap CSS is hard to implement, but getting better at it. And faster.
Thanks Richard, I was completely off the rails on this.
|
|
|
|
 |
Just to throw on the pile a little more, have you considered using a data-binding framework like Knockout, Backbone, or Angular? They do have the benefit of working on data as if it's at the base data level, rather than having to reverse-engineer the data from a rendered view.
|
|
|
|
 |
No I haven't considered it. I heard of Angular but have no clue what it is.
Nathan Minier wrote: rather than having to reverse-engineer the data from a rendered view.
But I rendered the content in the view with JQuery after the GET call.
I mean I used jQuery to download the cart items and construct the HTML for it.
Then wrote this post to update the item qty and total price.
Feel free to elaborate ...
|
|
|
|
 |
Well, general JavaScript and jQuery do not support any sort of data binding, so when data is modified for any reason you may miss it, or use JavaScript to walk the DOM until you locate the appropriate element.
Data binding frameworks eliminate this necessity. You can use them to bind a JavaScript variable to an element on the DOM. This means that when a value is updated either from an AJAX call or from user interaction, the change reflects in both the script and on the DOM.
For instance, I could rewrite your sample as:
<html ng-app="myApp">
...
<div ng-controller="myCartController">
<div class="cartRecord" ng-click="doSomething()">
<div class="cartQty">
<input type="text" ng-model="model.quantity" />
</div>
<div class="cartSKU">
<span>{{model.SKU}}</span> </div>
<div class="cartDescription">
<span>{{model.Description}}</span>
</div>
<div class="cartPrice">
<span>{{model.price | currency : '$' : 2}}</span>
</div>
<div class="cartTotal">
<span>{{model.total}}</span>
</div>
</div>
</div>
<script type="text/javascript">
angular.module('myApp',[])
.controller('myCartController',['$scope',function($scope){
$scope.model = MethodToGetModelFromAJAX();
$scope.model.total = $scope.model.price * $scope.model.quantity;
$scope.doSomething = function(){
}
}
</script>
</html>
Never mind the Angular-specific syntax, that code will allow you to populate the HTML via AJAX, update the quantity and recalculate the total, format the currency, and will even "do something!" on click.
|
|
|
|
 |
That sounds and looks cool!
That may reduce my development time, after the learning curve.
So this is what most folks are using today? and is well accepted?
I'm pretty far behind on MVC, and need to catch up.
|
|
|
|
 |
It seems to go one of two ways (in the ASP.NET world).
The first is .NET MVC where the majority of the work is done server-side, so data-binding in JavaScript isn't terribly important. The problem is that it relies on postbacks and viewstate. In those formats state is tracked on the server so JavaScript needs are generally fairly minimal.
The other common pattern is the Single-Page Application using WebAPI and a data-binding framework (mine's Angular, hence the example). You use flat HTML as templates and only serve data from your controllers. This approach getting more common, because it can do a very solid job of acting like a native application. State resides on the client in this format, and the ASP.NET modules just provide data.
Hybrid approaches like the one you describe, where you use MVC with AJAX, do happen, but by and large people lean one way or the other due to the complexity of managing state on both server and client side.
|
|
|
|
 |
Nathan Minier wrote: .NET MVC ... it relies on postbacks and viewstate.
I think you're getting confused between WebForms and MVC.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
 |
Meh, ViewData.
Session cookie is still sort of the same thing though. Ish.
I won't debate it, though, or you'll start quoting GUIDs at me from memory.
|
|
|
|
 |
This particular view I'm working on is a single form, Order Form, which collects the
Customer
Billing and Shipping Address
Cart Items
Sub totals
Shipping and etc
all on 1 form or view.
I respect your knowledge, and rather than take days to study it and research, I'll just ask
Should I adopt Angular for this view?
|
|
|
|
 |
<button type="button" class="btn btn-primary" id="create">create</button>
and <script> is:
$('#create').click(function(){
$('#createDoctor').jtable('showCreateForm');
}); </script>
its not opening the JTable add new Record form. this is in content page
in footer page i was add
<script src="${baseURL}/lte/plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- jQuery UI 1.11.4 -->
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js" type="text/javascript"></script>
Am struggling a lot any help plz......
|
|
|
|
 |
<div id='create'/>
and how to write the code to open new Record form in button click
|
|
|
|
 |
If you want help, you'll need to be more specific - asking a question on an Internet forum (such as CodeProject) is a skill, and one that needs to be learned. The first thing to think about is the person reading your question and run through a mental check-list:
- Have I stated what I tried and why/how it failed? This avoids dead-end solutions where people suggest the same thing. It also shows you, as a questioner, have tried something. People on this forum are answering for free, and don't waste time helping people who are too lazy to do their own work, they do want to help those who have tried an got stuck
- Have I provided enough information for people in the forum to be able to answer the question - this is where your question really falls down. Remember we don't know what you are doing and,as mind-reading isn't feasible, you need to provide the information we need -"how to write the code to open new Record" immediately begs several questions: what do you mean by open - from a DB, as show the form to create a record?; What is a record? By open do you mean open or create?
As you haven't supplied any code - we can't even give you a help to start. At this point break down the problem - for example "How do I react to a button click in JS" - then google it (plenty of resources on that) if you can't do it yourself, then ask again here. By using these smaller steps you'll be able to build up a bigger system.
|
|
|
|
 |
hi,
am having
<div id="create"/>
then in script
$('create').jtable('showCreateForm');
its not opening the jtable add new record form.
how to solve it
thanks in advance..
modified 10-Feb-16 3:47am.
|
|
|
|
 |
$('#create').jtable('showCreateForm');
|
|
|
|
 |
yes...tried with that but error in console is:
$(..).jtable is not a function
|
|
|
|
|