|
thanks for your reply..
then..if it won't work, what's the benefit of using JS functions over asp.net validation controls??
|
|
|
|
|
The benefit is that the valiidation is done on the client side whithou a roundtrip to the server.
I don't think there are many user who disable javascript in there browser. I the do, they cannot use more than half of the web.
Wout Louwers
|
|
|
|
|
JavasScript is also usefull when you are using Ajax into your code
|
|
|
|
|
Please stop posting. This blantly obvious statement adds no value to the conversation and is well know by anyone with modirum of knowledge.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I think either you do not know the thing in regards to dotnet and sharepoint or you donot want to accept the things. I have only posted that thing which i have done.
|
|
|
|
|
Don't get cocky son. I think you'd better have a look around before making such a statement.
Please stop posting until you have some value to add.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I hope for the same.. But even though it is better to stop it here and again i would like to say thanks....
|
|
|
|
|
How to we carry out Validations using JAvascript
|
|
|
|
|
What have you tried? How did that work? What specific issues did you have?
There are a myriad articles both here and through Google that will help you with a general question.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
are you trying to implement the JS validation functions in asp.net application?
If Yes,
try this one..
use the Js function in the section
function CheckValidation() {
if (document.getElementById('<%=txtString.ClientID %>').value == '') {
Msg = "Enter string..! \n"
}
}
and use the method in the asp.net textbox control as follows:
<asp:textbox id="txtString" onblur="CheckValidation(this)" runat="server">
|
|
|
|
|
hi guys
can javascript read usb device like flash disks?
|
|
|
|
|
|
|
You can't run hta (html application) from web sites. No browser supports it. The file needs to be downloaded to run locally.
|
|
|
|
|
Simply No. That would be huge security hole
|
|
|
|
|
Yes, you can do this with javscript.
But if you run javascript from a webpage, the access to local disks including flash disks is blocked.
Wout Louwers
|
|
|
|
|
hi,please help me out,how can I get "args" for resizableImg method???
<br />
<br />
MyImgConfWin = Ext.extend(Ext.Window, {<br />
<br />
constructor : function() {<br />
var fbutton = new Ext.ux.form.FileUploadField({<br />
listeners : {<br />
'fileselected' : function(fb, v) {<br />
<br />
<br />
var args = this.setEditorStyle(v);<br />
<br />
this.resizableImg(args);<br />
<br />
},<br />
scope:this<br />
}<br />
});
<br />
MyImgConfWin.superclass.constructor.call(this, {<br />
<br />
});
<br />
},
<br />
<br />
resizableImg : function(args) {<br />
var x = args[0],<br />
y = args[1],<br />
maxH = args[2],<br />
maxW = args[3];<br />
},
<br />
<br />
setEditorStyle:function(src){<br />
var imgEl = Ext.get('MyImgConfWin-imgEdiId'), <br />
imgDom = imgEl.dom,<br />
resizableEl = Ext.get('MyImgConfWin-imgResizableId'), <br />
resizableDom = resizableEl.dom;<br />
<br />
var imgHelper = new Image(),<br />
imgHelperH = null,<br />
imgHelperW = null;<br />
<br />
var args = [];<br />
imgHelper.onload = function() {<br />
<br />
imgHelperH = imgHelper.height;<br />
imgHelperW = imgHelper.width;<br />
<br />
var h = (356 > imgHelperH) ? imgHelperH : 356;<br />
var w = (415 > imgHelperW) ? imgHelperW : 415;<br />
<br />
h = (40 > h) ? 40 : h;<br />
w = (40 > w) ? 40 : w;<br />
<br />
imgDom.style.height = h;<br />
imgDom.style.width = w;<br />
<br />
<br />
resizableDom.style.height = (80 < h) ? (h / 2) : 40;<br />
resizableDom.style.width = (80 < w) ? (w / 2) : 40;<br />
<br />
<br />
imgDom.style.marginTop = (356 > imgHelperH)<br />
? ((356 - imgHelperH) / 2)<br />
: 1;<br />
imgDom.style.marginLeft = (415 > imgHelperW)<br />
? ((415 - imgHelperW) / 2)<br />
: 1;<br />
<br />
imgDom.src = src;<br />
<br />
<br />
var x = imgEl.getX(), y = imgEl.getY();<br />
x = (h > 100) ? (x + 10) : x;<br />
y = (w > 100) ? (y + 10) : y;<br />
<br />
var maxH = (356 > imgHelperH) ? (h-5) : 300;<br />
var maxW = (415 > imgHelperW) ? (w-5) : 380;<br />
<br />
args.push(x);<br />
args.push(y);<br />
args.push(maxH);<br />
args.push(maxW);<br />
<br />
<br />
}<br />
imgHelper.src = src;<br />
<br />
reutrn args;<br />
<br />
},
<br />
});
<br />
N/A
|
|
|
|
|
Hi
I have an application that will display text context(Ex: Questions and Answers). My application has an option to display "Black text on white Background" or "White text on Black Background".
We are also providing Print function to print text.
I am facing an issue here , when I am printing when the mode is "White text on Black Background" i am still seeing printed content as "Black text on white Background" on some machines (very few) with same IE version.
Can we restrict styles when we are printing using Javascript.
I am using below javascript for printing.
document.frames['My_frame'].focus();
document.frames['My_frame'].print();
Thanks,
Salmon.
|
|
|
|
|
You need to specify a style sheet just for printing as:
<link href="Print.css" rel="stylesheet" type="text/css" media="print" />
<link href="Screen.css" rel="stylesheet" type="text/css" media="screen" />
In the style sheet (print) are styles that are only used to print and that will replace any other styles.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
HI thanks for your reply,
Currently I am using one style sheet that doesnot have any media attribute.
Do i need to add one more style sheet with same CSS class names with media attribute as Print.
Please suggest
|
|
|
|
|
Yes, as per my example you have one style sheet for the 'screen' and one for 'print' (There are other options as well but not pertinent here). The one for print can contain styles that, for instance, render buttons and other clutter hidden and display other elements that you wouldn't normally want to see on the screen. You'll need to experiment to get what you want but that, essentially, is how it is done.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
I have to Get data from database and fill data into ListBox using javascript. I did like below
var strConn = 'Provider=SQLOLEDB;server=localhost;user id=sa;pwd=***;initial catalog=xxx;';
var cn = new ActiveXObject("ADODB.Connection");
cn.open(strConn);
var rs = new ActiveXObject("ADODB.Recordset");
rs.Open('SELECT EmpId,Name FROM Employee', cn);
rs.MoveFirst
while(!rs.eof)
{
var opt = document.createElement("Option");
opt.text = rs.fields(1);
opt.value = rs.fields(0);
document.getElementById(ListBoxCtrlName).options.add(opt);
rs.movenext;
}
rs.close;
cn.close;
This is working fine in IE only when access datasource across domains enabled otherwise listbox not getting data.How can I fix this issue in IE And FireFox
|
|
|
|
|
DONT DO THIS! I CANNOT STRESS STRONGLY ENOUGH HOW BAD THE CODE ABOVE IS.
1) Exposing a connection string in javascript code
2) Exposing the sa password in javascript code
3) Relying on ActiveX, which is IE only (this one answers your question).
4) In any case, most uses of IE will get a security warning when running this code, it is inherantly unsafe to allow this code to run.
As to how normal, qualified people "fill a listbox from a database using javascript" - they use AJAX, which is to say javascript makes an HTTP request to a serverside script (probably ASP.NET in your case) which returns the data only to javascript for filling the listbox. At no time can the user see anything about the database connection.
|
|
|
|
|
Connection string and Getting data from database in .js file. So its not visible.
|
|
|
|
|
Js files can be downloadable by normal users even don't need hackers. It's totally a wrong way, use AJAX as J4amieC said.
|
|
|
|