|
Hi
I have a menu, and i want when i click on one of item, that item be opened and i can show the sub menu when i click on sub items, and it cloesd if i change the top menu
plz help
more thanks
|
|
|
|
|
How can we help?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I have C# code dynamically adding a textbox named txtDodic to a data table in the code behind and setting it to a Width of txtDodic.Width = (10 * 4); as so:
tc = BaseControl.CreateTableCell(tr, null, "ColDodic", null);
txtDodic = BaseControl.CreateTextBox(tc.Controls, prefix + "txtDodic", "", "ASPTextBox", "TextBoxDodic");
txtDodic.Attributes.Add("onkeypress", "ValidateDodicInput();");
txtDodic.Width = (10 * 4);
I want to change the Width of the textbox txtDodic to a width of txtDodic.Width = (10 * 16) in a JavaScript function as so:
document.getElementById('" + txtDodic.ClientID + "').Width = (10 * 15);
The problem is that when the JavaScript function is called the width does not change. Please help.
Thanks,
Steve
|
|
|
|
|
You have to use the style attr to set the width
Plus add the ID to the textbox
Now you can use javascript to program the textbox.
txtDocdic.ID = "txtDoctic"
txtDoctic.ClientIDMode = static
txtDocdic.style.add(Htmltextwriterstyle.width, (10 * 4) & "px")
|
|
|
|
|
How do I get the actual txtDocdic to set the ID, static, and style. Do I use var txtDocdic = document.getElementById('" + txtDodic.ClientID + "')? What I did was this:
Script.AppendLine(" txtDocdic.ID = 'txtDoctic'; txtDoctic.ClientIDMode = static; txtDocdic.style.add(Htmltextwriterstyle.width, (10 * 4) & 'px');");
and this did not work.
modified 27-Apr-15 10:41am.
|
|
|
|
|
there should be a property in asp.net called ClientIDMode, you set that to the value needed. Static most likely
Actually when you make a dynamic textbox, its sort of like this in c#
You have to get the server side code right before you fix your javascript.
TextBox txt_firstName = new TextBox();
txt_firstName.ID = "txt_firstName"
txt_firstName.clientIDMode = clientIDmode.static;
txt_firtName.attributes.add("onkeypress", "makeBigger(); return false;";
controls.add(txt_firstName);
Then fix your javascript.
function makeBigger(){
alert('I fired');
var txt = document.getelementbyid('txt_firstName');
txt.style['width'] = '100px';
}
Now look at your HTML source code in your browser, and double check that the ID is correct in the textbox and javascript.
|
|
|
|
|
Dear Sir,
I have a php page and with php way I get the information with below code:
$link = $_SERVER['HTTP_REFERER'];
and but now I want get this information with "document.referrer" and then send to php.
I don't know how i can send this information to php.
Best Regards
|
|
|
|
|
|
I am wrote code in jquery in onBeforeUnlaod event to show broser alert to the user. Here i have situvation to know user clicks on the "Leave the page" button or "Stay on the page" button, based on the button i need to write some code.
Please help me if any of you know about this.
Thansk for your Help.
|
|
|
|
|
Please do not post in multiple places.
Broser conformation alert[^]
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
|
I want to force users to enter dates in a textbox as mm/yyyy
The following works:
<html>
<head>
<title></title>
<script type="text/javascript" >
function testFormat(v) {
//var re = new RegExp("^([1-9]|1[0-2]|0[1-9])/(\d{4})$");
var re = new RegExp(document.getElementById("txtR").value);
if (v.match(re) && (v.length==7)) {alert('ok');} else { alert('oops');}
}
</script>
</head>
<body ><form runat="server" id="Form1">
<input type="text" id="txtR" value="^([1-9]|1[0-2]|0[1-9])/(\d{4})$" style="width:200px;" />
<br />
<input type="text" id="txtA" onblur="testFormat(this.value)" style="width:100px;" />
</form></body>
</html>
However:
- Why does the commented out javascript line not work? Instead I have to use this silly workaround of putting the regular expression in a text field, (well, I can make this hidden) and reference that. It's the only way I can make it work - but it's daft.
- In order to force a 2-digit month, I have added the test for v.length==7 - but it must be possible to amend the regex to check for this? Damned if I can see how...
|
|
|
|
|
Ta - but it still doesn't work. Not sure either how that particular modifier would help anyway?
|
|
|
|
|
Try this:
<script type="text/javascript">
function testFormat(v) {
var re = new RegExp(/^(1[0-2]|0[1-9])[/]{1}([2-9]\d[1-9]\d|[1-9]\d)$/);
if (v.match(re)) { alert('ok'); } else { alert('oops'); }
}
</script>
Should also take care of your "7" problem
modified 18-Apr-15 21:29pm.
|
|
|
|
|
Consider yourself raised to "Hero" status!
IDK how anyone gets their head round regular expressions. I don't pretend to be a genius, but I like to think I'm reasonably intelligent, but regex's defeat me. I'd have more chance solving a Rubik's cube blindfold.
Thank you.
|
|
|
|
|
Hi
umm.. hate to say this, but this doesn't actually work!!!
12/2015 = OK, but
12/1995 = false ??
12/2000 = false ??
any deas..?
|
|
|
|
|
for 12/1995, you see where it says: [2-9] - change it to [1-9]
It was assuming 2000+
12/2000 - just a sec... Let me check it out...
|
|
|
|
|
Ta - that bit works.. For the other - it doesn't seem to like a double-0 ...
|
|
|
|
|
Less restrictive:
<script type="text/javascript">
function testFormat(v) {
var re = new RegExp(/^(1[0-2]|0[1-9])[/]{1}(\d{4})$/);
if (v.match(re)) { alert('ok'); } else { alert('oops'); }
}
</script>
|
|
|
|
|
Thanks ever so
|
|
|
|
|
|
Ta - Not being funny, but you didn't have a grandad (?) who was a Latin teacher by any chance did you? I had a Peter Kornfield teaching that to me way back in the 60's/70's..... (least, I'm pretty sure it was 'Peter'.) He was an alright bloke...
|
|
|
|
|
I definitely had a grandfather , but he was a travelling salesman of textiles...However I'm not sure he ever got to the UK, and in the 60s/70s he was clsoe to 60/70 as he was born in 1904...
(What funny is that as a travelling salesman he spoke 7 languages - not including Latin, which he has learned in school but never used)
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Yeah, well I had two!! OK, not him then. He was interesting - he had a gammy leg as a resuilt of some Nazi 'experiments' which he was unfortunate enough to be caught up in, but fortunate enough to survive. IDK the full story, being only a schoolboy at the time. But he had to spray some kind of medication on it even all these years later which used to stink to high heaven. But we all got used to it. He actually died in my last year there. Never forget his lessons, though can't say I've had much use for Latin either! Suppose it's sort of useful sometimes thinkng about the etymology of words....
|
|
|
|
|
Wombaticus wrote: resuilt of some Nazi 'experiments' My grandfather too survived one of those horrible things, they called it Auschwitz...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|