|
I've always liked the book "The JavaScript Bible." I have the first edition, which doesn't cover Opera, but the newer edition(s) may - I just haven't seen it to verify.
Also, developer.netscape.com is a good start too, but it won't cover Opera.
Jeremy Falcon
Imputek
<nobr>"C# is the answer to a question nobody asked." - Chris Losinger
|
|
|
|
|
Sweet....I figured out a most interesting way of implementing the above, but one thing still gets me...
In NS you have the elements collection for iterating all elements in the document and IE offers the same using the all collection. However getElemenyById was introduced by the W3C to eliminate cross browser incompatibilities(I assume anyways). Does this mean both major browser players will eventually eliminate these collections of theirs in favour of the W3C standard getElementById() ...?
Just curious
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
getElemenyById isn't supported in NS 4.7 or below. So if you have that to worry about, you're out of luck.
|
|
|
|
|
if I have the following..
<TD></TD><TD id="Something">Something</TD><TD><IMG/></TD>
How could I get the id of the IMG tag from inside an onMouseOver of the id="something" TD tag...?
IE supports a property called owningElement which I think does something like this...?
Is there any way I can retreive the IMG id ( I want to change the src property ) without supplying the IMG tag an ID also...??
i'm thinking if I could somehow use the all collection:
onMouseOver:
var i = document.all(this.curIndex)+2;
document.all(i).src = "diff.gif"
does something like curIndex exist...?
I would like this to be cross browser...so NS elements collection and IE all collection won't work...
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
i want to know the information about this kind of project
suppose there are 100 NIIT centres accross the country and i want to develop a software which would do the billing and details of all the students in these centres accross whole country...i mean info about students and their payments online with clicks...
plz tell me from where to get help or this project ??
thnx
rashmi
|
|
|
|
|
my tables are:
skills: skill(str), skillID(autonumber))
subcategory: subcategory(str), subcategoryid(autonumber), skillID(int)
i am obtaining the value for skill in the string type via a text box(strSkill). however, i need to save this value to the subcategory table as its ID number (ie as an interger value). i am trying to use a SQL statement to derive its related ID, but am failing to do so. where is the problem?
dim sql
sql = "SELECT DISTINCT SkillID FROM Skills WHERE (((Skills.Skill)='" & replace(strSkill,"'","''") & "'))"
Set RS = objConn.Execute(SQL)
If Not bolAlreadyExists Then
RS.AddNew
'adding the new subskill to the table
RS("SubCategory") = Request.Form("SubCategory")
RS("SkillID") = Request.Form("Skills")
'closing the recordset and connection object
RS.Update
RS.Close
thank you!
|
|
|
|
|
Hmmm...ok. Here is a note; you don't need to place DISTINCT in front of SkillID if it is defined as an autonumber and the only field you are selecting (those will always be distinct). If you already have your variable skill defined you should be able to do something like this to get the SkillID:
dim conn
dim rs
set conn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
'if you haven't defined your skill do it here
dim skill, SkillId
skill = replace(Request.Form("skill"), "'", "''")
sql = "SELECT SkillID FROM skills WHERE skill = '" & skill & "'"
conn.ConnectionString = "[.......]"
conn.Open
rs.ActiveConnection = conn
rs.Open(sql)
If Not rs.EOF Then
SkillId = rs("SkillID")
End If
If SkillId = "" Then
'Add New Record Here
End If
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
HTH
Nick Parker
|
|
|
|
|
is it possible to pass values between forms when using the Response.Redirect Method?
If (Request("City") = 22) Then
Dim strSkill
strSkill = Request.Form("Skills")
Response.Redirect("add3.asp")
Else.....
in the above code section, i wish to pass the value contained in the "Skills" combo box (located on prev page), but when redirected to the add2.asp form , the value is lost. is there any way to rectify this using VBSCript?
thank you?
|
|
|
|
|
Pass it in the QueryString -
Response.Redirect("add3.asp?skills=" & strSkill)
Then retrieve it using
Request.QueryString("skills")
Paul
|
|
|
|
|
You can do as pd suggests above or do a Server.Transfer("add2.asp") , do remember that you can not create a QueryString with the Server.Transfer method as you can with a Response.Redirect . The advantage of doing a Server.Transfer method is that you can simple request the values you want as if the page posted back to itself, it essentially post all fields from the form over to the page you specify.
Nick Parker
|
|
|
|
|
I've hit a wall.
I'm working with a web-based DataGrid, using Template Columns bound to a dataset.
Once column contains a text box for the Item template and DropDownList for the Edit Template. The Dropdowns are populated from a DataTable within the DataSet being used.
Everything displays properly (i.e. the DDL contains all of the expected values), but upon entering the "edit mode" for a row, the
DropDownList is always set to the FIRST entry!
How can I get the DDL to select the correct value?
Not sure if this will make it more or less clear...
<br />
<asp:TemplateColumn HeaderText='Company Name'><br />
<ItemTemplate><br />
<asp:Label id=Label3 runat='server' Text='<%# DataBinder.Eval(Container,'DataItem.CompanyName') %>'><br />
</asp:Label><br />
</ItemTemplate><br />
<FooterTemplate><br />
<asp:dropdownlist DataSource='<%# GetCompanies() %>' DataTextField='Name' DataValueField='CompanyID' runat='server' ID='cmbFooterCompanyID'><br />
</asp:dropdownlist><br />
</FooterTemplate><br />
<EditItemTemplate><br />
<asp:dropdownlist DataSource='<%# GetCompanies() %>' DataTextField='Name' DataValueField='CompanyID' runat='server' ID='cmbEditCompanyID'><br />
</asp:dropdownlist><br />
</EditItemTemplate><br />
</asp:TemplateColumn><br />
Thanks.
Mike Stanbrook
mstanbrook@yahoo.com
|
|
|
|
|
You need to set the selectedindex property of the dropdownlist.
Todd Smith
|
|
|
|
|
Todd Smith wrote:
You need to set the selectedindex property of the dropdownlist.
I've tried, but I'm not sure WHERE or WHEN (in the page lifecycle) that should be set.
Also, I am not clean on how to get the index from the Dataset/DataTable where the values are stored.
Mike Stanbrook
mstanbrook@yahoo.com
|
|
|
|
|
Problem statement: given a document like this:
<?xml version="1.0" encoding="utf-8"?>
<Page xmlns="/PageWriter/TemplateSchema.xsd" xmlns:XHTML="http://www.w3.org/1999/xhtml">
<Head>
<!-- Irrelevant stuff here -->
</Head>
<Body>
<XHTML:p>See, this is how XHTML elements work.</XHTML:p>
<ASP.NET>Response.Write("And this is how ASP.NET is supposed to work!");</ASP.NET>
</Body>
</Page>
called Doc.mhcx (MadHamster Creations XML page format), I want to produce an .aspx file like this:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<!-- Irrelevant stuff -->
</head>
<body>
<p>See, this is how XHTML elements work.</p>
<% Response.Write("And this is how ASP.NET is supposed to work!"); %>
</body>
</html>
And then serve it up to the client.
Progress so far: I can do everything, except when my <ASP.NET> tags get involved. Then, given a simple <xsl:value-of select="." /> , it will transform all my <s, >s, and &s into their entity equivelants. Needless to say, this is bad.
I got around this with an almost painless hack for JavaScript by this code:
<xsl:text disable-output-escaping="yes"><![CDATA[<% Response.Write(PageWriter.UnescapeText(@"]]></xsl:text>
<xsl:value-of select="translate(., '"', '░')" />
<xsl:text disable-output-escaping="yes"><![CDATA[")); %>]]></xsl:text>
Where the current context (. ) is the JavaScript code and PageWriter.UnescapeText is a ASP.NET function that will fix all the <s, >s, and &s that XSL mangled. There's also an added complication that because this is going to be a string paramter, I use XSL to turn all "s into ░s (░s, if the browser will display this) on the assumption that nobody will ever use that character in JS code, and then PageWriter.UnescapeText turns those weird characters back into "s. This is to avoid making every " in the JS end the parameter to PageWriter.UnescapeText . Ugly, but it works.
But this obviously doesn't work for ASP.NET, because I can't pass ASP.NET code to an ASP.NET function (unless there's some JS eval type function I'm not aware of somewhere?) So...
Current idea for a hack, the implementation of which is not working right now:
If the .mhcx document has <ASP.NET> tags (inputDoc.GetElementsByTagName("ASP.NET").Count > 0 ), then do special things, like:
create a temporary .mhcx file with all <s, >s, and &s replaced by far-out Unicode characters that nobody will ever use. Then do normal transformation of .mhcx to .aspx. Of course, at this point we've still got weird Unicode chars, so read in the .aspx file, turn the chars back into <s, >s, and &s, then write out the .aspx file again.
Finally, display this .aspx file to the client.
Notes: This is really rather repulsive.
The best solution would be to make XSL somehow spit out <s, >s, and &s unmolested. That fixes everything, really. No need for any special cases, even for JavaScript code.
Another not-so-great solution would be to have my output format for XSL be text instead of XML. Then it won't mangle things, but... that's just wrong, y'know?
I guess I could also give up XSL entirely and just use ASP.NET processing... unhappy, but painless.
Otherwise, I'm kind of at a loss.
Please note that speed won't be an issue. Although all this processing is currently done on every request, in the future I'll just have a .exe that will scan all .mhcx files on my local server and turn them into .aspxs. Then, assuming this .exe is run after any changes to .mhcx files, all the .mhcx handler will have to do is lookup the URL for the corresponding .aspx, which is quite simple and speedy.
Help?
-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..."
|
|
|
|
|
Well, I've it working. Now it's simply a matter of this is not pretty, I hate it! instead of This is not pretty and it doesn't work and I'm tired of staring at exceptions.
I migrated my server-sided solution for ASP.NET code to JavaScript also. So basically, whenever a file has <JavaScript> or <ASP.NET> tags, all <s, >s, and &s inside of those tags will be transformed into high-up Unicode characters. Then this new document will be XSL'ed into a .aspx file, and finally I will turn the Unicode characters back into <s, >s, and &s. The end result is then shot to the client.
If a file doesn't have those tags, it will be XSL'ed like normal.
-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 have a combo-box which displays a list of skills. however, if i wish to add another skill, i also have an option in the combo-box "Add a Skill". how do i redirect the user to the "add" page if they choose this option? (if they choose any other option, it goes to a different page).Here's my (very incorrect!)code:
<SELECT NAME="Skills">
<%
Do While Not RS.EOF
Response.Write "<OPTION VALUE='" & RS("Skill") & "'>"
Response.Write RS("Skill")
RS.MoveNext
Loop
%><option value="add">Add a Skill</option><%
RS.Close
objConn.Close
Set RS = Nothing
Set objConn = Nothing
%>
</SELECT>
<P>
<INPUT TYPE="submit" name="btnAdd" value="Register">
<INPUT TYPE="submit" name="btnAdd" value="Add">
<%
If (Request("btnAdd") = "Add") AND (Request("Skills") = "Add a Skill") Then
Response.Redirect("add2.asp")
end if
%>
....further code....
thank you!
|
|
|
|
|
mcm wrote:
Here's my (very incorrect!)code:
You are going to kick yourself
Your if statement is checking for the TEXT attribute of the selected drop down item, not the VALUE attribute.
So just change this line If (Request("btnAdd") = "Add") AND (Request("Skills") = "Add a Skill") Then to If (Request("btnAdd") = "Add") AND (Request("Skills") = "add") Then and voila, should work (works on mine.)
So otherwise your code is fine.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
Simon Walton wrote:
"You come across a lot of people who call themselves realists, when they are actually pessimists attempting to look intelligent."
|
|
|
|
|
thank you so much for your help! im afraid i tried that and it didnt work - it seems to be ignoring the if statement completely - it always directs itself to the register.asp page.
|
|
|
|
|
mcm wrote:
thank you so much for your help! im afraid i tried that and it didnt work - it seems to be ignoring the if statement completely - it always directs itself to the register.asp page.
Hmm odd. Could you email me the output (the actual HTML produced after having run your ASP script) and the ASP file itself?
I noticed you are not closing your OPTION elements which could be a problem and also the actual values from your recordset may be interefering with the select element.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
Simon Walton wrote:
"You come across a lot of people who call themselves realists, when they are actually pessimists attempting to look intelligent."
|
|
|
|
|
Does anyone have a simple example of how I can implement collapsable tables? (like the way the forum posts work here in DHTML mode)
Basically I want to be able to put a link at the top of a table that when clicked will collapse away the table so that only the header is visable (clicking on the link again would re-expand the table).
Being able to specify (in the html) whether a table starts open or closed would be a bonus too, but I'm not worried about things like making sure only one table is visable (I just want to be able to let users hide away unneeded information)
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
benjymous wrote:
Basically I want to be able to put a link at the top of a table that when clicked will collapse away the table so that only the header is visable (clicking on the link again would re-expand the table).
Quite simple once you figure it out. All you need to do is set the style.display attribute of an element to none to hide it, and block to display it. You can use JavaScript to do this client-side.
You can default it to hidden by using a style="display: none" attribute on the elements.
Here is a very simple example and can be easily expanded for a dynamic page by replacing the element IDs with a variable.
<table>
<tr>
<td style="cursor: hand; background-color: #cccccc;" onclick="javascript:if (document.all.descrip1.style.display == 'none'){document.all.descrip1.style.display = 'block'}else{document.all.descrip1.style.display = 'none'}">Title 1</td>
</tr>
<tr id="descrip1">
<td>Description</td>
</tr>
<tr>
<td style="cursor: hand; background-color: #cccccc;" onclick="javascript:if (document.all.descrip2.style.display == 'none'){document.all.descrip2.style.display = 'block'}else{document.all.descrip2.style.display = 'none'}">Title 2</td>
</tr>
<tr id="descrip2">
<td>Description</td>
</tr>
</table>
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
Simon Walton wrote:
"You come across a lot of people who call themselves realists, when they are actually pessimists attempting to look intelligent."
|
|
|
|
|
Brilliant!
Lets see if I can get this working with my site
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
more details please - test message for forum
|
|
|
|
|
|
Interesting...is this supported NS6+ also...? Or would you have to use visibility property for that...?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|