|
I have an code that i use to retrive data from access DB and to show into textbox.
<%
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:OBS","","");
} catch(Exception e) { out.println(e);}
if(con!=null) {
try {
Statement statement = con.createStatement();
ResultSet rs = statement.executeQuery("SELECT * from userform where srno='"+id+"'");
while(rs.next()) {
n=n+1;
%>
<input type="text" name="fname" value="<%=rs.getString(2)%>" width="15" />
|
|
|
|
|
Unless you run the web application locally on the client I would avoid using Javascript to access any database. If the application is not running locally, try ASP.Net as an alternative and run the database on the server.
V.
|
|
|
|
|
Hi,
The below code works well without placing master pages.
ListBox-lst_Siblling
Up button:btn_Up
OnClientClick="MoveUp();return false;"
I want the same code working with master page.
<script language="javascript" type="text/javascript">
function MoveUp() {
var con = document.getElementById("lst_Siblling");
var up = document.getElementById("hid_Up");
up.value = "";
if (con.selectedIndex >= 0) {
alert("HAI");
for (var count = 1; count < con.options.length; count++) {
if (con.options[count].selected == true) {
alert("INSIDE");
var tem = con.options[count].text;
con.options[count].text = con.options[count - 1].text;
alert(parseInt(con.options.length));
up.value = parseInt(con.options.length) - 1;
alert(up.value);
if (con.options[count - 1].selected == false) {
con.options[count].selected = false;
}
con.options[count - 1].selected = true;
con.options[count - 1].text = tem;
}
}
}
else {
alert('Select any item');
}
}
function MoveDown() {
var con = document.getElementById("lst_Siblling");
var selvalue;
var up = document.getElementById("hid_Up");
up.value = "";
if (con.selectedIndex >= 0) {
for (var count = con.options.length - 2; count >= 0; count--) {
if (con.options[count].selected == true) {
var tem = con.options[count].text;
con.options[count].text = con.options[count + 1].text;
selvalue = parseInt(con.options[count].value) + 1;
up.value = selvalue;
alert(up.value);
if (con.options[count + 1].selected == false) {
con.options[count].selected = false;
}
con.options[count + 1].selected = true;
con.options[count + 1].text = tem;
}
}
}
else {
alert('Select any item');
}
}
</script>
Guhananth.S
|
|
|
|
|
Master page has nothing to do with whether the javascript will work or not. What problems are you experiencing? What have you done to debug it?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hey plz help me i tried to make o program in which user inputs a number between 1 to 10 and its table appears..but i its not working properly..when i press a number table of 2 prints every time.
plz help me in finding mistake.thnks
<html>
<title> :Tables: </title>
<head>
<script type = "text/javascript">
function disp_promt()
{
}
</script>
</head>
<body>
<h2> TABLES USING FOR LOOP </h2>
<script type = "text/javascript">
var number = prompt("Please enter a number between 2 to 10", "")
if (number=2)
{
for (num=1; num<=10; num++)
{
document.write("2 x " + num + "=" + 2*num + "<br>");
}
}
else if (number=3)
{
for (num=1; num<=10; num++)
{
document.write("3 x " + num + "=" + 3*num + "<br>");
}
}
else if (number=4)
{
for (num=1; num<=10; num++)
{
document.write("4 x " + num + "=" + 4*num + "<br>");
}
}
else if (number=5)
{
for (num=1; num<=10; num++)
{
document.write("5 x " + num + "=" + 5*num + "<br>");
}
}
else if (number=6)
{
for (num=1; num<=10; num++)
{
document.write("6 x " + num + "=" + 6*num + "<br>");
}
}
else if (number=7)
{
for (num=1; num<=10; num++)
{
document.write("7 x " + num + "=" + 7*num + "<br>");
}
}
else if (number=8)
{
for (num=1; num<=10; num++)
{
document.write("8 x " + num + "=" + 8*num + "<br>");
}
}
else if (number=9)
{
for (num=1; num<=10; num++)
{
document.write("9 x " + num + "=" + 9*num + "<br>");
}
}
else if (number=10)
{
for (num=1; num<=10; num++)
{
document.write("10 x " + num + "=" + 10*num + "<br>");
}
}
else
{
document.write("You haven't entered a number between 2 to 10");
}
</script>
</body>
</html>
|
|
|
|
|
replace
if (number=2)
with
if (number==2)
and do the same for all the other if statements 3 through 10.
Alternatively, replace the whole lot with just
var number = prompt("Please enter a number between 2 to 10", "")
for (num=1; num<=10; num++)
{
document.write(number + " x " + num + "=" + number*num + "<br>");
}
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MULTIPLE TABLE EXAMPLE4 Page</title>
</head>
<body>
<h2>
<:: MULTIPLE TABLE EXAMPLE4 ::>
</h2>
<script type="text/javascript">
var number = prompt("Please enter a number for Multiple-Table :: ","");
var range = prompt("Please enter the Range ::","20");
for (i=1; i<=range; i++)
document.write(number+" x " + i + " = " + (number * i) + "<br>");
</script>
</body>
</html>
|
|
|
|
|
<html>
<title> :Tables: </title>
<head>
<script type = "text/javascript">
function disp_promt()
{
}
</script>
</head>
<body>
<h2> TABLES USING FOR LOOP </h2>
<script type = "text/javascript">
var number = prompt("Please enter a number between 2 to 10","");
switch(number)
{
case '2':
for (num=1; num<=10; num++)
{
document.write("2 x " + num + "=" + 2*num + "<br>");
}
break;
case '3':
for (num=1; num<=10; num++)
{
document.write("3 x " + num + "=" + 3*num + "<br>");
}
break;
case '4':
for (num=1; num<=10; num++)
{
document.write("4 x " + num + "=" + 4*num + "<br>");
}
break;
case '5':
for (num=1; num<=10; num++)
{
document.write("5 x " + num + "=" + 5*num + "<br>");
}
break;
case '6':
for (num=1; num<=10; num++)
{
document.write("6 x " + num + "=" + 6*num + "<br>");
}
break;
case '7':
for (num=1; num<=10; num++)
{
document.write("7 x " + num + "=" + 7*num + "<br>");
}
break;
case '8':
for (num=1; num<=10; num++)
{
document.write("8 x " + num + "=" + 8*num + "<br>");
}
break;
case '9':
for (num=1; num<=10; num++)
{
document.write("9 x " + num + "=" + 9*num + "<br>");
}
break;
case '10':
for (num=1; num<=10; num++)
{
document.write("10 x " + num + "=" + 10*num + "<br>");
}
break;
default:
document.write("You haven't entered a number between 2 to 10");
}
</script>
</body>
</html>
|
|
|
|
|
<html>
<title> :Tables: </title>
<head>
<script type = "text/javascript">
function disp_promt()
{
}
</script>
</head>
<body>
<h2> TABLES USING FOR LOOP </h2>
<script type = "text/javascript">
var number = prompt("Please enter a number between 2 to 10","");
switch(number)
{
case '2':
for (num=1; num<=10; num++)
{
document.write("2 x " + num + "=" + 2*num + "<br>");
}
break;
case '3':
for (num=1; num<=10; num++)
{
document.write("3 x " + num + "=" + 3*num + "<br>");
}
break;
case '4':
for (num=1; num<=10; num++)
{
document.write("4 x " + num + "=" + 4*num + "<br>");
}
break;
case '5':
for (num=1; num<=10; num++)
{
document.write("5 x " + num + "=" + 5*num + "<br>");
}
break;
case '6':
for (num=1; num<=10; num++)
{
document.write("6 x " + num + "=" + 6*num + "<br>");
}
break;
case '7':
for (num=1; num<=10; num++)
{
document.write("7 x " + num + "=" + 7*num + "<br>");
}
break;
case '8':
for (num=1; num<=10; num++)
{
document.write("8 x " + num + "=" + 8*num + "<br>");
}
break;
case '9':
for (num=1; num<=10; num++)
{
document.write("9 x " + num + "=" + 9*num + "<br>");
}
break;
case '10':
for (num=1; num<=10; num++)
{
document.write("10 x " + num + "=" + 10*num + "<br>");
}
break;
default:
document.write("You haven't entered a number between 2 to 10");
} </script>
</body>
</html>
|
|
|
|
|
This code:
var allowedChars = "qwertyuiopasdfghjklzxcvbnm1234567890/'קראטוןםפךלחיעכגדשזסבהנמצ";
var card = document.getElementById("cardid").value;
for (i=0; i< 10; i++)
if (allowedChars.indexOf(card[i]) == -1)
{
alert("Error");
return true;
}
is supposed to check an input string.
For an unknown reason, it works on ff 3.6.10, but not on IE 7.
Help will be highly appreciated.
Thanks,
Summer Bulb.
|
|
|
|
|
I don't think you can use
card[i]
to refernce the i'th character in a string this way, not in IE anyway. Try
card.charAt(i)
instead.
|
|
|
|
|
why you do not use regular expression?
var reg=/[qwertyuiopasdfghjklzxcvbnm1234567890]{10}/gi;
if(!reg.test(document.getElementById("cardId").value)){
alert("Error");
}
see more javascript skill, just click moocr.com
|
|
|
|
|
I have several pages that I open using target="_blank", which all have somekind of functionality in them. When some of these pages close I would like to have the page that made the initial call to do a refresh so that the new data is displayed. Is is possible?
|
|
|
|
|
I am not sure whether this is the best solution. But my 2 cents...
May be you could open those pages as a popup, when the popup is closed a javascript function can be called. Check out the following post for an example http://www.eggheadcafe.com/articles/20060117.asp[^]
I will post if I am able to think of/find a better way...!
Cheers,
Karthik
|
|
|
|
|
I had tried popups, I wanted it to be cleaner and only open new tabs in newer browsers, so that is why I used _blank. That being said, if I have to go back to popups then I guess I will have to go back to them.
|
|
|
|
|
What about this method?
Check out the following page. http://www.rgagnon.com/jsdetails/js-0049.html[^]
You could open the window and maintain a list of handles in an array. And then you could have some kind of javascript that executes using setTimeOut. This script could verify if the current handle is open (i.e. check if handle.closed is true/false) and then refresh the page using window.location.href
Cheers,
Karthik
|
|
|
|
|
If the page that made the initial call is the html page that opened the popup then yes. You could attach a javascript event to notify you when the 'popup' gets closed or unloaded.
For example (page1.html):
<a href="page2.html" target="_blank">Add something</a>
<script>
function onPage2Unload(){
alert('tada');
}
</script>
Then you could have something like this on your page2.html:
<script>
window.onbeforeunload = function() { window.opener.onPage2Unload(); }
</script>
In this setup the page2.html will call the window that opened it (page1.html) and execute the code of onPage2Unload before closing or unloading the document.
|
|
|
|
|
Hi all,
I am using a firefox plug in called Live HTTP Headers.
Right now I am trying to filter only left the URL Address and time.
Can anyone help me?
Then convert it back to XPI format.
Need help in it.
|
|
|
|
|
Is this in any way connected to this[^] question?
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
I want to read the Javascript method body
how could I do this, could u refer me few links
Thanks
SaiNath
|
|
|
|
|
You want to read the code which is inside the {} of function?
sunaSaRa Imdadhusen
+91 99095 44184
+91 02767 284464
|
|
|
|
|
Are you saying you want to read the method body?? I don't see why you would want to do that, but this link might be useful - http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256BF8004D72D6[^]
This one loops through all properties in an object passed and you could modify this method to find out the contents of your function alone. Out of curiosity, if you don't mind, what is this for?
Cheers,
Karthik
|
|
|
|
|
function func(){
alert('1');
}
document.write(func);
try it! moocr.com
|
|
|
|
|
Is it possible to call a method of jar file which is residing in Client side, through java script. this is required to access USB port for testing tool development.
Here is give a simple example to help me with code snippet.
A simple Java program (simple.java) which has two methods GetName() and GetID() which returns string and integer value respectively. which is then converted to jar(simple.jar) and placed in C:\Temp\simple.jar.
Can some one help me in java script code snippet, how to call the jar file inside my html file, and how to access the GetName() and GetID() method.
Note: Simple.jar file will be at client machine and NOT at server side, may be i have to learn how to use plugin to download simple.jar from server to client (will be happy if i get some pointers on this too!)
FYI, I am newbie to javascript.
|
|
|
|
|
if dont consider the safe or you browser allow, you can do it use javascript.
but you'd better dont do this operation.
moocr.com
|
|
|
|