 |
 |
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
|
|
|
|
 |
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 yesterday.
|
|
|
|
 |
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(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...
|
|
|
|
 |
Message Removed
modified 18-Apr-15 15:33pm.
|
|
|
|
 |
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.
|
|
|
|
 |
Although you've got a solution, I can't obviously see that anyone's given you an explanation why the commented out line doesn't work.
var re = new RegExp("^([1-9]|1[0-2]|0[1-9])/(\d{4})$");
In Javascript strings[^], the backslash (\ ) is used to escape the following character. As a result, your pattern actually comes out as:
^([1-9]|1[0-2]|0[1-9])/(d{4})$
That's looking for the literal character "d ", not the digits character class "\d ".
You can solve it by either escaping the backslash within the string:
var re = new RegExp("^([1-9]|1[0-2]|0[1-9])/(\\d{4})$");
or using a regular expression literal:
var re = /^([1-9]|1[0-2]|0[1-9])\/(\d{4})$/;
NB: For a regular expression literal you have to escape the forward-slash (/ ) character, since that's also used to terminate the literal.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
 |
We've got jQuery, if I want to put something somewhere I just go
<div id=a_field_name></div>
not quite as nice as
<% a_field_name %>
or even
{{a_field_name}}
but has the significant advantage of being in the DOM, and is trivial yet very flexible to assign.
i.e less proper code, and HTML is always orrible anyway. That's why we write templating systems, so we can give it to someone else, right ?.
With forms, the job is even easier, and the need for YATS even less clear. Why should you need to go
<input id=a_field_name value={{a_field_name}}>
when this is clearly sufficient
<input id=a_field_name>
and just as trivial as before to assign.
I also have lots of other stuff I need to do with forms, such as attaching the appropriate field handlers and selector widgets, things which should be implicit where possible but ideally can be overridden by the UI designer. I am thinking about reading my hibernate XML definition files, which I believe you can load into their own DOM and access with jquery, to decide on field length, and type and hence the handler, and "not null" etc.
There is a library here http://davestewart.io/plugins/jquery/jquery-populate/ but I am concerned that nothing has happened for 5 years. Are there any other libraries that populate, and read, form data and may be tackle assigning event handlers.
|
|
|
|
 |
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
.style1
{
width: 443px;
height: 181px;
}
.style2
{
width: 154px;
}
.style3
{
width: 132px;
}
</head>
<body style="height: 247px; width: 781px">
<form id="form1" runat="server">
</form>
</body>
</html>
|
|
|
|
 |
Within some javascript I want to be able to go something like
#include "file1.js"
and for that to get evaluated/included/inserted at retrieval time (but cached ideally) and recursively, i.e. for file1.js to have includes of its own, and for duplicate requests to be skipped. Just like the C Preprocessor would do.
So I am about to do precisely that, wire up cpp as a cgi and fetch my javascript through that. Using apache html SSI looks messy, or messier.
For distribution I just make a call to the webserver for my top level file and save the response.
Are there better ways of doing this ?.
modified 13-Apr-15 9:42am.
|
|
|
|
 |
I set my name properly. I am at second phase of development of my first javascript. I'm ready to start factoring out some good stuff I've done and package it off nicely.
So I need to read all this
RequireJS
And I presume I then useMinify
Edit: No, there's a thing called uglify in requirejs.
Basically the answer to my question is "yes there is, we're all using requirejs. go learn".
modified 14-Apr-15 7:15am.
|
|
|
|
|
 |
Need a lot more info.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
 |
I have an application deployed on one server and from this server I want to pop up a new window, which will open a asp.net page deployed on any other server, using window.open() and I want to pass parameters to this pop up window. I don't want to pass parameters through URL. Need some way to pass parameter in a hidden or more secure way.
Can anyone suggest how this can be done.
Thanks in advance.
|
|
|
|
|
 |
first we r finding the grid
like this
var grd=document.getElementById("GridView1");
after how can we get a selected row value in grid using javascript
|
|
|
|
|
 |
hi everyone can anybody help me for below functionality
i have button and grid on webform1 and i need to transfer data from gridview(seleted row) to webform2 using javascript.
|
|
|
|
 |
You can use Ajax[^]... Web Sockets[^]... LocalStorage[^] and many other options to share your data from one form to another.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
 |
i have a file,file format is CMYK(Cyan,Magenta,Yellow,Black),file have 7 layer include background,i want to multiply layer by Formula,
layer 1(cmyk)---C1,M1,M1,K1
layer 2(cmyk)---C2,M2,M2,K2
Merge all layers ways:
Layer 1 (C1, M1, Y1, K1) and layer 2 (C2, M2, Y2, K2) and Layer 3 (C3, M3, Y3, K3), ......
1.
Layer 1 and Layer 2 identical coordinate positions, with C for example
A. If C1>= C2, C = C1 + C2-2 * C1 * C2 / 100 + C1 * C1 * C2 / 10000
B. If C2 > C1, C = C1 + C2-2 * C1 * C2 / 100 + C2 * C2 * C1 / 10000
then Layer 1 and Layer 2 merged into layer 1
2.
Layer 1 and Layer 2 identical coordinate positions, with C for example
A. If C1 >= C3, C = C1 + C3-2 * C1 * C3 / 100 + C1 * C1 * C3 / 10000
B. If C3 > C1, C = C1 + C3-2 * C1 * C3 / 100 + C3 * C3 * C1 / 10000
then Layer 1 and Layer 3 merged into layer 1
3.
Layer 1 and Layer 4 identical coordinate positions, with C for example
A. If C1 >= C4, C = C1 + C4-2 * C1 * C4 / 100 + C1 * C1 * C4 / 10000
B. If C4 > C1, C = C1 + C4-2 * C1 * C4 / 100 + C4 * C4 * C1 / 10000
then Layer 1 and Layer 4 merged into layer 1
........
pls help
|
|
|
|
 |
I have a html page where I am loading PDF file using Div.
I need to refresh that Div only once without refreshing whole page using javascript or jquery.
Need urgent help.
Thanks.
|
|
|
|
 |
jQuery provides the load method[^]:
Load data from the server and place the returned HTML into the matched element.
$("#result").load("ajax/test.html");
However, you cannot display a PDF file directly within a <div> tag. You would need to use an <iframe> , or some other PDF viewer control.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
 |
+5
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
 |
How to make a Content Slider in JavaScript with all the function eg play, pause, replay, seek on the slider for moving back and front, sync slider with audio and contents
|
|
|
|
 |
Content slider and play pause buttons are totally different things. You are combining a media player with a content slider.
Do it yourself, using jQuery players[^], and a content slider[^].
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
 |
Then remove the jQuery from search box, and search for JavaScript version. What prevents you from doing so?
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
 |
Normally JSON data is fetched in the following form from Web API etc.
[
{"name" : "Steve", "Age": 76}, {"name": "Jeremy", "Age": 43}
]
You can see that "name" and "Age" is repeating with every column. But I've seen a service getting data in this fashion. Which really shorten the JSON object something like that.
[
columns: {"name", "age"}
data: {"Steve",76},{"Jeremy",43}
]
How to do it?
|
|
|
|
 |
well, you can tweak the Json a little,
{
"name" : ["Steve", "Jeremy"],
"Age": [76,43]
}
looks greatly shortened..
|
|
|
|
 |
But you lost all the good in JSON...
I would say that compressing the traffic will do better...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|