|
Good one
sunaSaRa Imdadhusen
+91 99095 44184
+91 02767 284464
|
|
|
|
|
Thank you for your help and insight. It is now working correctly, and I am marking your answer as correct accordingly. Best Regards, Pat
|
|
|
|
|
I am using javascript to create three tabs with field in the asp.net web application.
while validating the second tab the message is displayed in the label but the selected tab is the first one.
the java script is as follows
function Function1()
{
document.getElementById('Tab1').style.display = "none";
document.getElementById('Tab2').style.display = "block";
document.getElementById('Tab3').style.display = "none";
}
server side code
Button1.Attributes.Add("OnClick", "Javascript:return Function1()");
ScriptManager.RegisterStartupScript(this, this.GetType(), "Function1", "Button1_OnClick", true);
|
|
|
|
|
What html elements are Tab1, Tab2 and Tab3? Div, span, p, ?? You should perhaps read about element display, http://www.webdesignfromscratch.com/html-css/css-block-and-inline/[^]
I can't tell from the code provided what exactly you are trying to accomplish but it seems better handled on the client-side with out a post just to have the button call function1.
You should also look into JQuery[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Do you want to validate only those validation they are available only on first tab or selected tab using javascript?
sunaSaRa Imdadhusen
+91 99095 44184
+91 02767 284464
|
|
|
|
|
Isn't that a question and should have a Question or General icon?
..Go Green..
|
|
|
|
|
I guess this could be considered a tip as well as a possible question.
I've found that if I have a table with the first row having a colspan value, i.e. header for the table, then deleting the last remaining row below the colspan row deletes the colspan row too.
Check it out - paste the following into an .html, add a few rows, then delete a few rows.
<html>
<head><title>JS Dynamic Table Test</title>
<script language="JavaScript">
<!--
function AddRow() {
var a_misctext = ["Gary","Mary","Larry","Harry","June","Marge","Lisa","Tina","Rika","Susan"];
tbl = document.getElementById('DataArea');
lastrow = tbl.rows.length;
workrow = tbl.insertRow(lastrow);
workrow.insertCell(0);
workrow.cells[0].innerHTML = "<nobr>"+a_misctext[Math.floor(Math.random()*10.0)]+"</nobr>";
workrow.insertCell(1);
workrow.cells[1].innerHTML = "<input type=\"button\" value=\"x\" onClick=\"PopRow(this.parentNode.parentNode.rowIndex);\">";
return false;
}
function PopRow(x) {
document.getElementById('DataArea').deleteRow(x);
}
</script>
</head>
<body>
<form>
<table id=DataArea cellpadding=4 cellspacing=0 border=0>
<tbody>
<tr><td colspan="2">My Stuff <input type="button" value=" Add " onClick="AddRow();"></td></tr>
</tbody>
</table>
</form>
</body>
</html>
I "fixed" it by turning the colspan row into 2 separate columns:
<br />
<tr><td>My Stuff</td><td><input type="button" value=" Add " onClick="AddRow();"></td></tr><br />
Any idea why the table would collapse when deleting the last row?
|
|
|
|
|
var row=x.parentNode.parentNode
row.parentNode.removeChild(row)
PopRow(this)
|
|
|
|
|
yup, that worked!
looks like I have a lot to learn... Thanks for teaching...
|
|
|
|
|
Hi,
I have Two tables in my page
Table 1 having list for checkbox with name CHK1
Table 2 also having list of checkbox with same name CHK1
using javascript i want to get the checkboxs form table 1.
|
|
|
|
|
You can get with providing id of table like
your first table id is table1
Now you can get the check box inside the table1
var ele = document.getElementById('table1').getElementByTagName('input')
for(var c=0;c < ele.length; c++){
if(ele[c].type=='checkbox'){
}
}
Please do let me know, if you have any doubt.
Please provide "Vote" if this would be helpful, and make "Accept Answer" if this would be correct answer.
Thanks,
Imdadhusen
sunaSaRa Imdadhusen
+91 99095 44184
+91 02767 284464
modified on Thursday, October 28, 2010 9:16 AM
|
|
|
|
|
I think you'd better change one list checkbox name.
if not, you can do it like the above answer, but it's not very good, i improve it at below:
var ele = document.getElementById("table1").getElementsByTagName("input");
var size = ele.length;
var boxs = [];
var j=0;
for(var i=0;i<size;i++){
if(ele[i].type=="checkbox" and ele[i].name=="CHK1"){
boxs[j++]=ele[i];
}
}
do you like more js or web skills? just click my blog! moocr.com
|
|
|
|
|
you can use '#table1 input:[name = CHK1]' as your parameter, and it will search get the checkbox of first table only..
|
|
|
|
|
How to handle key events in Pocket Internet Explorer using javascript?
|
|
|
|
|
Does the browser in Pocket Internet Mobile support javascript? If it does, so you can using javascript as the same as on windows platform.
|
|
|
|
|
if the browser support the JavaScript, please use the event.keycode properties to identify the keypress event happened and then do your functions.
|
|
|
|
|
Hi,
While running my application if any error gets then, a modalbox will show with the error message, So I close the modalbox using "Esc" key. In the meantime the next ajax request and response is stopped in the browser since i pressed "Esc" key.
So I want to close modalbox using "Esc" and also the next ajax request and response do not stopped by the browser?.
Can anybody help me how can i handle this?
Regards,
Periyasamy.R
|
|
|
|
|
Most browsers use the Escape key to cancel out of loading a page and I think it is probably also causing any other AJAX requests being processed to also be canceled by your browser.
As for stopping this default behavior, you could try preventing the Esc key's default action with the following:
e.cancelBubble=true;
e.returnValue = false;
if (e.stopPropagation){
e.stopPropagation();
e.preventDefault();
|
|
|
|
|
Hi,
Thanks for your reply. Great!. It works for me.Now the ajax request and response is not stopped when i use "Esc" or any key. Its good.
Thanks,
Regards,
Periyasamy.R
modified on Thursday, October 28, 2010 2:22 AM
|
|
|
|
|
Are you talking about a regular javascript modal message box or a html/css/js modalbox? If it's the latter, I would call it's close function prior to stopping the event propagation in your keydown handler.
|
|
|
|
|
Hi Jules,
It works for me.
Thanks for your reply.
-Periyasamy.R
|
|
|
|
|
Hi,
I close a "Modalbox" popup using "Esc" key. In the mean time, the pop up is closing but, the ajax request and response also stopped. Can anybody help how to avoid this?.
Regards,
Periyasamy.R
modified on Tuesday, October 26, 2010 7:36 AM
|
|
|
|
|
Hi Everyone,
Is it possible to close all tabs in the browser using javascript in IE7 & Firefox. Please let me know if anyone has the code.
Thanks in Advance.
Regards,
Manowj
|
|
|
|
|
I don't think you can close tabs you didn't open through javascript (imagine the havoc that would cause, if every web page you went to closed all your other tabs).
If you did open it (using window.open()), you can close it using window.close() or self.close().
- S
50 cups of coffee and you know it's on!
Code, follow, or get out of the way.
|
|
|
|
|
Yes, you are right! javascript can not close a window without any confirm or alert if it did not open the window use window.open();
moocr.com
|
|
|
|