|
Greetings -
I'm a GIS specialist having to code a front end to a GIS application, and I've got what is probably a really simple question. If anyone can help me I would be indebted to you, and could pay you back by some GIS advice if you ever need it.
I found a cool set of scripts for Re-ordering a list box but I can't figure out if I put the Client Script into an .ASP page, how do I call the Server Script and have it return the new list order like is done in the demo?
Where do I put the Server Script, into the client script somewhere, or in its own file? If into its own file, what kind of file is it? I've tried many variations on this, and can't get it to work as the demo http://www.siteexperts.com/tips/elements/ts32/page1.asp[^] does.
thanks in advance,
LJ
****Client Script****
//Copyright 2000 InsideDHTML.com, LLC. All rights reserved.
function outputList(ar, name, size) {
var strIDs = "<SELECT SIZE=\"" + size + "\" NAME=\"ro_lst" + name + "\">"
var sel = " SELECTED"
for (var i=0;i<ar.length;i++) {
strIDs += "<OPTION " + sel + " VALUE=\"" + ar[i][0] + "\">" + ar[i][1]
sel = ""
}
strIDs+="</SELECT>"
strIDs+="<INPUT NAME=\"" + name + "\" TYPE=hidden>"
return strIDs
}
function outputButton(bDir,name,val) {
return "<INPUT TYPE=button VALUE=\"" + val + "\" ONCLICK=\"move(this.form," + bDir + ",'" + name + "')\">"
}
function move(f,bDir,sName) {
var el = f.elements["ro_lst" + sName]
var idx = el.selectedIndex
if (idx==-1)
alert("You must first select the item to reorder.")
else {
var nxidx = idx+( bDir? -1 : 1)
if (nxidx<0) nxidx=el.length-1
if (nxidx>=el.length) nxidx=0
var oldVal = el[idx].value
var oldText = el[idx].text
el[idx].value = el[nxidx].value
el[idx].text = el[nxidx].text
el[nxidx].value = oldVal
el[nxidx].text = oldText
el.selectedIndex = nxidx
}
}
function processForm(f) {
for (var i=0;i<f.length;i++) {
var el = f[i]
if (el.name.substring(0,6)=="ro_lst") {
var strIDs = ""
for (var j=0;j<f[i].options.length;j++)
strIDs += f[i].options[j].value + ", "
f.elements[f.elements[i].name.substring(6)].value = strIDs.substring(0,strIDs.length-2)
}
}
}
var arrList = new Array()
arrList[0] = new Array("1","Test Item 1")
arrList[1] = new Array("2","Test Item 2")
arrList[2] = new Array("3","Test Item 3")
arrList[3] = new Array("4","Test Item 4")
arrList[4] = new Array("5","Test Item 5")
arrList[5] = new Array("6","Test Item 6")
document.write(outputButton(true,"test","Move Up") + "<BR>")
document.write(outputList(arrList,"test",10) + "<BR>")
document.write(outputButton(false,"test","Move Down"))
****Server Script****
Dim arItems,i, strIDs
strIDs = request.form("test")
if strIDs="" then
' Initialize
strIDs = "1, 2, 3, 4, 5, 6"
else
response.write("Reordered....")
end if
arItems = split(strIDs,", ")
response.write("" & chr(13) & chr(10))
response.write("var arrList = new Array()" & chr(13) & chr(10))
for i=0 to uBound(arItems)
response.write("arrList[" & i & "] = new Array(""" & arItems(i) &
""",""Test Item " & arItems(i) & """)" & chr(13) & chr(10))
next
|
|
|
|
|
Javascript allows you to put functions in an external (.js) file. Can I do the same thing with VBScript? I tried it and started getting errors on my asp page (despite having the appropriate <script> line in the asp file.
Any help?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi John
To include VbScript for server-side code:
<script language="VBSCRIPT" src="Inc/Global.vbs" runat="Server"> </script>
or:
<!--#include file="Inc/CheckSecurity.asp" -->
To include VbScript for client-side code (but only for IE browsers:
<script src="Inc/global.vbs" language="VbScript"> </script>
Regards
Andy
|
|
|
|
|
andyharman wrote:
That one did the trick. Many thanks.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Visual Studio.NET
I have formA, with an edit button, the edit button does a response.redirect as follows:
Response.Redirect("FormB.aspx?QuoteToLoad=" & selectedItem)
When I run it it tries to run the page load event of a different form (formC). Why would it do that? How can I fix it?
|
|
|
|
|
There is nothing in the code that you have shown that suggests that FormC would be loaded, so the reason has to be in some of the code that you haven't shown.
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks, I found the "codeBehind" property was set to FormC, I opened teh aspx file in a text editor and changed it and all seems to be well. Not sure how it got goofed up....
|
|
|
|
|
hi there
i have a table-repeated region(php) inside a div.
i need it to show 3 records and the other ones below-scrollable
ofcourse i won't make framesets!
how will i make it scrollable??
backround:scroll or backround-attachment:scroll won't work
thanks
ninja coding
|
|
|
|
|
Set the div's style to "overflow:scroll;"
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Thanks John it works,but how will i get rid of the horizontal scroll
that is completely useless??
ninja coding
|
|
|
|
|
As far as I know, you can't (in this case, you gotta take the good with the bad). I use the same technique to constrain my web page content so that the header/menu and footer are always displayed. The content scrolls, but the page itself does not.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Before anyone jumps in moaning bout bars they don't want, there's also an overflow-x / overflow-y....oops too late
"Knock me down, I'll get straight back up again, I'll come back stronger than a powered up pacman"
(Lilly Allen / Kaiser Chiefs)
|
|
|
|
|
thanks it works...but..there's always a but
shows perfect on mozilla ,any solution for IE5-6?
ninja coding
|
|
|
|
|
My web site works in ie and mozilla and i don't recall doing anything special to make this work in both browsers.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
yeah the scroll works but i don't have a bar!!
the div is scrollable with no bar in IE6
i think it looks cool but as i was fooled ,i'm sure my visitors also will be and will not try to scroll
any comments?
ninja coding
|
|
|
|
|
Looking at your further questions, what exactly are you doing? Under ie6 / 7 in our app, we use the following:
<div style="overflow-x:scroll; overflow-y:none">
Which works beautifully, providing only one scrollbar...are you sure your content is big enough to need a scroll?
"Knock me down, I'll get straight back up again, I'll come back stronger than a powered up pacman"
(Lilly Allen / Kaiser Chiefs)
|
|
|
|
|
o yes it works after all...sorry
but if u have the time please browse this demo from Ie and mozzila and see the difference on the right side of my content-scrollbar-
http://boatguide.gr/view.php?cat=2
if i place another div in the right of my main table it goes right on top of the scrollbar in IE offcourse,in mozzilla everything is smooth as always
Any css advise would be much appreciated
thanks for your time
ninja coding
|
|
|
|
|
Ahhhhh - I see what you mean - looks like it's caused by the old IE / MOZ border problem (IE considers the border to be outside the area of an element, moz inside, so the widths ofter go a little screwy) - do a quick google for CSS Box Hacks and you should find something...
"Knock me down, I'll get straight back up again, I'll come back stronger than a powered up pacman"
(Lilly Allen / Kaiser Chiefs)
|
|
|
|
|
Hi Guys,
Can you help me, do you have any example on how to upload the image(jpg) and save it into mssql2000?
Thanks in advance Guys
hifiger2004
|
|
|
|
|
|
I already solved it
hifiger2004
|
|
|
|
|
if (FileUploadPicture3.PostedFile.ContentLength!=0)
{
//cmd==command
//Add picture3 in Database
Stream imgStream2 = FileUploadPicture3.PostedFile.InputStream;
int imgLen2 = FileUploadPicture3.PostedFile.ContentLength;
byte[] imgBinaryData2 = new byte[imgLen2];
int o = imgStream2.Read(imgBinaryData2, 0, imgLen2);
SqlParameter param5 = new SqlParameter("@Picture3", SqlDbType.Image);
param5.Value = imgBinaryData2;
cmd.Parameters.Add(param5);
//for retriev image:
try
{
byte[] barrImg3 = (byte[])rrd.GetValue(rrd.GetOrdinal("Picture3"));
string strfn3 = root + @"\iimage\" + rrd.GetValue(rrd.GetOrdinal("Picture3")).ToString() + "c3.gif";
FileStream fs3 = new FileStream(strfn3, FileMode.Create, FileAccess.Write);
fs3.Write(barrImg3, 0, barrImg3.Length);
fs3.Flush();
string strpath3 = "~/iimage/" + rrd.GetValue(rrd.GetOrdinal("Picture3")).ToString() + "c3.gif";
//thumbnail #3
if (fs3.Length != 0)
{
fs3.Close();
System.Drawing.Image img3 = System.Drawing.Image.FromFile(Server.MapPath(strpath3));
System.Drawing.Image thumbnailImage3 = img3.GetThumbnailImage(100, 100, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallBack), IntPtr.Zero);
MemoryStream imageStream3 = new MemoryStream();
thumbnailImage3.Save(Server.MapPath("~/image/thumbc3.gif"), System.Drawing.Imaging.ImageFormat.Gif);
byte[] imageContant3 = new byte[imageStream3.Length];
Response.Clear();
h3.ImageUrl = "~/image/thumbc3.gif";
h3.NavigateUrl = "show_picture.aspx?id=" + id + "&type=cp3&name=church&profile=adminupdate";
}
else
{
h3.Visible = false;
}
}
catch (Exception ex) { }
|
|
|
|
|
Hi,
I develop a site named www.abc.com . When I want to do a specific job on this site the full URL is shown such as www.abc.com/abc/abc. But I only want to see www.abc.com in URL not the full path. Please help me with code in PHP or Java Script.
Kunal maity
|
|
|
|
|
There are only a few ways to do this. You can either:
A) create the index page so that it is actually the whole site (bad idea)
B) use a frame in the main page to call the other pages (still a bad idea)
Brad
Australian
- bryce on "Problems with Code Project"
*sigh* Maunder's been coding again...
|
|
|
|
|
use Server.Redirect() for new pages..
|
|
|
|