|
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.
|
|
|
|
|
SatyaKeerthi15 wrote: So its not visible.
says who?
|
|
|
|
|
Hello all,
I'm really keen on the kind of "overview menu" (for lack of a better description) which you can find for example at www.raytheon.com - the one with the big red buttons. Does anyone know if somelike this is available from somewhere? I haven't myself been succesful in my search. I could develop it but surely there must have been someone before me.
Many thanks,
Morten
|
|
|
|
|
There is nothing special about it, some li elements with styles.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
For those who may benefit,
I discovered the jcarosel jquery plugin, which is great for building menues such as the one I was searching for.
/M
|
|
|
|
|
Experts,
I have a problem which i need help with, I have a javascript page which will detect the users browser, if it is below a certain defined state another webpage will be displayed saying. Unfortunatly your web browser is not up to date.
This has all been done however how do i link pages through javascript?
i thought this would work however it doesn't
document.write("<href='oops.html'>");
I have also tried closing the javascript and opening a html tag (would look something like this)
</script>
<a href="../MWHAHA website/oops.html"></a>
<script type="text/javascript">
all i would like to do is open a html page if a statement is true or not.
If anybody can help that would be great
Cheers
Dan
|
|
|
|
|
location.replace('oops.html');
But,
your scheme seems wrong.
Exactly which browsers will you
disallow, and for what reason?
|
|
|
|
|
Hi thanks for your reply!
I will be disallowing browsers such as internet explorer which is < version 6 as my website will not function correctly in it.
I tried the location.replace('oops.html') but nothing happened.
The code i need something simular to this
if interent explorer <6 then
open url opps.html
else
do nothing
In the javascript i cannot get the url to load the page.
Thanks
|
|
|
|