|
Thanks. In particular I want to trap the <enter> key and no others. How could I use the onkeypress method to do this?
I feel like I'm diagonally parked in a parallel universe
Jeremy Davis
http://www.astad.org http://www.jvf.co.uk
|
|
|
|
|
Sorry! If you write <ENTER without <code> tags, it obviously disappears in the message. In particular I want to trap the <ENTER> key and no others. How could I use the onkeypress method to do this?
|
|
|
|
|
Jeremy Davis wrote:
Sorry! If you write tags, it obviously disappears in the message. In particular I want to trap the key and no others. How could I use the onkeypress method to do this?
LOL relax.
So you want to check if the user pressed the ENTER key. No problemo.
In the previously mentioned function put this code:
if (window.event.keyCode==65) alert ('A pressed !')
That will trap for the A key. Not sure what the ASCII/ANSI keycode is for enter, you need to look that up.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
Alison Pentland wrote:
I now have an image of you in front of the mirror in the morning, wearing your knickers, socks and shoes trying to decided if they match!
|
|
|
|
|
Sorry about the last two emails with missing words. I really should use "preview" first! If you write without tags, it obviously disappears in the message.
Anyway I want to trap the key and no others. How could I use the onkeypress method to do this?
I feel like I'm diagonally parked in a parallel universe
Jeremy Davis
http://www.astad.org http://www.jvf.co.uk
|
|
|
|
|
I'd like to validate as XHTML strict, I really, really would. But...
I can't get around a few things.
The first is that it doesn't like my language="JavaScript" attributes. Can I get away with just they type="text/javascript" part? That is, will the browser assume JavaScript unless tolds otherwise? I'm targeting IE/NS 4+ or so. I've heard about a <meta> tag somewhere for setting the default scripting type, but can't remember the syntax (or indeed if it's even useful at all).
The worst (IMO), is the lack of support for the target attribute of the <a> tag. Can I open links in new windows without resorting to JavaScript foolery? Surely the W3C hasn't gone that far...
Other than that, I'm completely XHTML Strict compliant!!!
Now if someone would tell me about this XHTML 1.1 stuff...
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
Using XHTML Strict is not easy and I wouldn't count on that old browsers accept type="text/javascript", but it's the only valid way. The meta command defines the same and only saves the type declaration in the script tags:
<meta http-equiv="content-script-type" type="text/javascript"/>
The target attribute is defined in the 'Target Module' of XHTML. I'm not sure how to import these modules to the XHTML DTD but I think this violation is really acceptable!
Have fun!
P.S.: What really sux is the deprecation of the style attribute!
|
|
|
|
|
Domenic [Geekn] wrote:
The worst (IMO), is the lack of support for the target attribute of the tag. Can I open links in new windows without resorting to JavaScript foolery? Surely the W3C hasn't gone that far...
You shouldn't need to open a new window from an <a> element. If you ever do need to open a new window then yes using JavaScript is ok, but it shouldn't originate from an <a> element, it is not expected behavouir for a link.
HTML is meant to structure a document. The W3C is moving HTML back to doing that, veering away from the application path that Netscape and IE sent it on.
Other technologies will then be used for the application side (e.g. XSL:FO.)
p.s. Saying all that, being XHTML Strict compliant is not worth it. Transitional is a good target to head for, especially in the real world.
Domenic [Geekn] wrote:
Can I get away with just they type="text/javascript" part? That is, will the browser assume JavaScript unless tolds otherwise? I'm targeting IE/NS 4+ or so. I've heard about a tag somewhere for setting the default scripting type, but can't remember the syntax (or indeed if it's even useful at all).
Didn't know about that, but on checking yes XHTML 1.0 Strict does not allow the language attribute. Weird.
Guess text/javascript will have to be the indicator. Though this sucks when it comes to IDEs which pop-up intellisense based on the language attribute.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
Alison Pentland wrote:
I now have an image of you in front of the mirror in the morning, wearing your knickers, socks and shoes trying to decided if they match!
|
|
|
|
|
Paul Watson wrote:
HTML is meant to structure a document. The W3C is moving HTML back to doing that, veering away from the application path that Netscape and IE sent it on.
I guess so. It just made more sense for external links not to take the user away from my site, but I suppose it is important to keep the document structured.
Hehe, you should see how structured I have my documents: they're XML files containing a mix of my own custom elements and XHTML, like so:
<?xml version="1.0" encoding="utf-8"?>
<Page xmlns="/PageWriter/TemplateSchema.xsd" xmlns:XHTML="http://www.w3.org/1999/xhtml">
<Head>
<Title>Home Page</Title>
<Image Width="225">/Images/PageTitles/HomePage.gif</Image>
</Head>
<Body>
<XHTML:p>
Blah Blah Blah <XHTML:em>Blah!</XHTML:em>
</XHTML:p>
<XHTML:p>
Hers's a link: <Link Href="/Creations/" Status="The Creations"
Comment="Go to the home page for my Creations, random C++ and C# programs I make in my
free time which you quite probably will find useful.">random C++ and C#
programming</Link>. More text.
</XHTML:p>
<Section Name="Sample">
This section is outputted with a title of "Sample."
</Section>
<Spacer Width="10" Height="50" />
<ASP.NET>Response.Write("Pretty cool, huh?");</ASP.NET>
<News>
<NewsItem Date="7/23/2002">
News for 7/23/2002.
</NewsItem>
<NewsItem Date="4/17/2002">
News for 4/17/2002.
</NewsItem>
</News>
</Body>
</Page>
Which gets transformed into a combo of XHTML and ASP.NET code. What do you think? I'm pretty proud of it myself...
Paul Watson wrote:
Guess text/javascript will have to be the indicator. Though this sucks when it comes to IDEs which pop-up intellisense based on the language attribute.
Don't get me started on IDEs... they hate XHTML. I wonder if I could write an addin for VS.NET to make it like XHML and output valid XHTML everywhere? Hmm...
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
Domenic [Geekn] wrote:
I guess so. It just made more sense for external links not to take the user away from my site
Well there is a lot of thinking on that matter and it is split 50/50 on whether new windows make sites stickier or not. I personally feel they don't.
Domenic [Geekn] wrote:
What do you think? I'm pretty proud of it myself...
Looks pretty sweet. You going to publish your system so that other people can use it sometime?
Domenic [Geekn] wrote:
Don't get me started on IDEs... they hate XHTML. I wonder if I could write an addin for VS.NET to make it like XHML and output valid XHTML everywhere? Hmm...
Well from what I know of at least the ASP.NET web controls is that you can sub-class them and write the valid XHTML code for them.
So then you have two versions of the web control. One, your sub-classed one, outputs valid XHTML while the other, the MS default one, outputs crap.
Various people have said they are going to do this, but nobody has yet done it. Will be cool when they do (it seems a bit of a job though, something you need stacks of time for.)
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
Alison Pentland wrote:
I now have an image of you in front of the mirror in the morning, wearing your knickers, socks and shoes trying to decided if they match!
|
|
|
|
|
Paul Watson wrote:
You going to publish your system so that other people can use it sometime?
That's the plan; once I complete at least a first draft of my website with it. I'll make sure to write an article for CP on it when I do.
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
I need to scroll to a link when my page loads.
How could i do it from JavaScript?
rechi
|
|
|
|
|
Bogdan Rechi wrote:
I need to scroll to a link when my page loads.
You'll want to use what's called a named anchor. Let's say this is your link...
<a href="something.html" name="mylink">Clickety</a>
To have the page go directly to it, append a pound sign after the URL followed by the name of the anchor. For instance...
http://www.somepage.com/mypage.html#mylink
It'll go directly to the link.
Now, to force that without having to type in the pound sign, etc. you could use one of many techniqes, but I'll focus on two.
In JavaScript...
<body ... onLoad="location.href += '#mylink';">
In a client-side redirect...
<head><br />
<meta http-equiv="refresh" content="0;URL=mypage.html#mylink"><br />
</head>
Jeremy Falcon
Imputek
<nobr>"..." - Paul Watson 07-17
|
|
|
|
|
In JavaScript...
That was all i've needed. And i promise: no more link s for anchor s!
Thanx for your effort.
rechi
|
|
|
|
|
I am trying to get a datagrid to update. Everything else
in it works. However when I try to retrieve the new value
it passes me the original value. Any Ideas? Thanks.
public void UpdateGrid(object sender, DataGridCommandEventArgs e)
{
UpdateVendor.Connection = Global.sqlConnection;
UpdateVendor.Parameters[0].Value = dgVendors.DataKeys[(int)e.Item.ItemIndex];
UpdateVendor.Parameters[1].Value = ((TextBox)e.Item.Cells[3].Controls[0]).Text;
UpdateVendor.Parameters[2].Value = ((TextBox)e.Item.Cells[4].Controls[0]).Text;
UpdateVendor.Parameters[3].Value = ((TextBox)e.Item.Cells[5].Controls[0]).Text;
UpdateVendor.Parameters[4].Value = ((TextBox)e.Item.Cells[6].Controls[0]).Text;
UpdateVendor.ExecuteNonQuery();
dgVendors.EditItemIndex = -1;
dgVendors.DataBind();
Response.Redirect("ManageVendors.aspx");
}
Steve
Not all who wander are lost...
|
|
|
|
|
Still can't get it? Did you read the article?
|
|
|
|
|
I read your article several times. Do I have explicitly have all the items be textboxs? Do I have to process the Textboxs OnTextChanged message even if I just want the end result? If the arguements passed are the original values what use is the update command? Thanks.
Steve
Not all who wander are lost...
|
|
|
|
|
a couple of points...
1. you are using a global sqlconnection....this could hog resources...i'd at least try to close it after every use and reopen it before every use...the datagrid is good at displaying disconnected data (that's that the System.Data.DataSet object is)
2. make sure you aren't calling DataBind() in your page_load event every time, or else it'll grab the data right from sql again
should be something like
public void page_load()
{
if (!Page.IsPostBack)
{
Page.DataBind();
}
else
{
//do nothing...page was posted back, and data will remain in datagrid unless changed in another function
}
}
hope this helps
michael griffith
--------------------
mgriffith@lauren.com
mdg12@po.cwru.edu
|
|
|
|
|
Here is what I am doing to create an sql statement to query my database and return records displaying them as a bulleted list:
1.<%
2.Set catRS = Server.CreateObject( "ADODB.Recordset" )
3.catRS.ActiveConnection = Con
4.sqlString = "SELECT DISTINCT product_category FROM Products "
5.sqlString = sqlString & "WHERE product_status=1 "
6.sqlString = sqlString & "ORDER BY product_category "
7.catRS.Open sqlString
8.%>
9.<% If cat = "Home" THEN %>
10.Home
11.
12.<% ELSE %>
13.Home
14.<% END IF %>
15.<% WHILE NOT catRS.EOF %>
16.<% IF catRS( "product_category" ) = cat THEN %>
17.
18.<%=catRS( "product_category" )%>
19.
20.<% ELSE %>
21.- "><%=catRS( "product_category" )%>
23.<% END IF %>
24.<%
25.catRS.MoveNext
26.WEND
27.%>
28.
29.<% catRS.Close %>
And I receive this error message when trying to open up the default.asp page that includes this catlist.asp file to populate a menu:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E0C)
Command text was not set for the command object.
/cham2DSN/catlist.asp, line 7
Can anyone give me any clues???
|
|
|
|
|
You might want to try that again, and check the "display as-is" box
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
Ok, here is my go at it, it does appear to be a little jumbing as ben said before.
Do something like this:
<%
Dim conn
Dim catRS
Dim sql
With Response
Set conn = Server.CreateObject("ADODB.Connection")
Set catRS = Server.CreateObject("ADODB.Recordset")
sql = "SELECT DISTINCT product_category FROM Products " & _
"WHERE product_status=1 ORDER BY product_category"
conn.ConnectionString = <code>[YourConnectionStringGoesHere]</code>
conn.Open
catRS.ActiveConnection = conn
catRS.Open sql
If Not catRS.EOF Then
.Write "<ul>" & vbcrlf
Do Until catRS.EOF
If catRS("product_category") = <code>"SomeWord"</code> or <code>Variable</code> Then
.Write "<li>" & catRS("product_category") & "</li>"
End If
catRS.MoveNext
Loop
.Write "</ul>"
End If
catRS.Close
set catRS = nothing
conn.Close
set conn = nothing
End With
%>
HTH
Nick Parker
|
|
|
|
|
3.catRS.ActiveConnection = Con
Where do your "Con" come from?
|
|
|
|
|
I am wondering how (if it is possible) to do the following:
You have a login form with a login ID (email address) and a password. When the user clicks the "Submit" button, go to a page that varifies the email address and password. That part I've got done -- easy.
What I would like is to have another button, or a link, that will go to a different page that will send the user their password in an email. So what I'm wondering is how can this other page (the one sending the email) get the email address the user entered on the form? I would rather not simply redirect them to a second page where they enter the email address. If possible, I would like to be able to read the email address entered on the login form. Can it be done? If so, how?
My understanding is that the data on the form is not available to subsequent pages until the form is submitted (which activates the "action" page, right?). Is there a way around that, or am I missing something basic?
Thanks.
|
|
|
|
|
<form action="original.html" method="post">
<input type="text" name="email">
<input type="password" name="passwd">
<input type="submit" value="OK">
<input type="button" value="Forgot Passowrd" onClick="this.form.action='newpage.html';this.form.submit();">
</form>
Jeremy Falcon
Imputek
<nobr>"..." - Paul Watson 07-17
|
|
|
|
|
It works like a charm.
That's excellent. Thanks.
|
|
|
|
|
David Fleming wrote:
I would rather not simply redirect them to a second page where they enter the email address. If possible, I would like to be able to read the email address entered on the login form. Can it be done? If so, how?
Jeremy's way works well, but an alternative (always good to have options) is to have the FORM still go to the same handling ASP page, but also have a hidden text box in the FORM which tracks which button was clicked.
Then in the ASP you can check which one was clicked and do whatever is appropriate.
The benefit is that you can save some coding by having only one ASP page and not two. The down side is there is a bit more code (HTML and JavaScript) on the originating FORM page.
If you need some help with the hidden text box method just ask...
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
Alison Pentland wrote:
I now have an image of you in front of the mirror in the morning, wearing your knickers, socks and shoes trying to decided if they match!
|
|
|
|