Hi folks,
Any ideas why this doesn't work?
<SCRIPT LANGUAGE="JavaS cript">
<!--
f = document.forms[1];
e = f.elements;
str = new String(e[0].value);
len = document.forms['testform'].d.options.leng th;
document.forms['testform'].d.options[len] = new Option(str, '1');
</script>
Basicaly, I am trying to fill my combo box on a HTML page (SELECT OPTION
field) manually, but the vallue I get every time is 'null', i.e. empty
string.
*Suspected error in the red line, since if I put in the last line "....new
Option('some',' 1');" it works.
I must have made some ridiculous error I can't see, so plz be free to make
fun of me :))
Thanks in advance.
IS
btw. if I put up an event at the Text field (onChange) the values can be transfered to my combo box trought a function call, but are lost as soon as I press Submit button I have next to my Text field. 1 2546
In article <bp**********@s hiva.neobee.net >, fi*******@yahoo .com
enlightened us with... Hi folks,
Any ideas why this doesn't work?
You only have one form on the page? <SCRIPT LANGUAGE="JavaS cript">
<script type="text/javascript">
<!-- f = document.forms[1];
This gets the second form. I hope that was what you wanted.
Otherwise, forms[0].
e = f.elements; str = new String(e[0].value);
I hope this element has a value and is either a text input or text area.
You didn't check.
len = document.forms['testform'].d.options.leng th;
I hope the select is named d.
document.forms['testform'].d.options[len] = new Option(str, '1'); </script>
Basicaly, I am trying to fill my combo box on a HTML page (SELECT OPTION field) manually, but the vallue I get every time is 'null', i.e. empty string. *Suspected error in the red line, since if I put in the last line "....new Option('some',' 1');" it works.
No "Red lines" for people with plain text mail readers.
You maybe better off using names, not numbers. Otherwise, if you move
elements around, you have to change all the code! I suspect the problem
is with e[0].value.
Try e["elementnam e"].value
Oh, and submitting "loses" values - the form blanks out once the page
location changes.
--
--
~kaeli~
In democracy your vote counts. In feudalism your count votes. http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dan Sikorsky |
last post by:
How can I get the recordset attributes for a table field in SQL Server 2000
to report the field updatable attribute correctly ... mine keeps saying the
fields are not updatable? That is, ( oRecordSet ( oItem ).Attributes & 0x4)
is always 0 for every field on SQL Server 2000
Example code:
var sSQL = 'SELECT TOP 1 * FROM WHERE ' + sUniqueField
+ '=' + sUniqueValue + ';';
|
by: Jon Maz |
last post by:
Hi,
I have been getting hopelessly confused with escaping escape characters in
JScript! All I want to do is write a simple funtion:
function DoubleUpBackSlash(inputString)
{
???????
}
|
by: Dr John Stockton |
last post by:
The following DOS prompt command line, in a Win98 DOS box,
cscript //nologo ~tmp.js
executes file ~tmp.js as javascript/Jscript.
The following batch file, similarly run, executes the same.
@echo off
|
by: Craig G |
last post by:
hi,
im only learning javascript, i have this little code snippet that i wish to
use. basically the code-behind page will display a little jscript confirm
message box
Public Sub ASPNET_MsgBox(ByVal Message As String)
System.Web.HttpContext.Current.Response.Write("<SCRIPT
LANGUAGE=""JavaScript"">" & vbCrLf)
|
by: SergioT |
last post by:
Hi
I wanna to create a jscript function that sets the value of a textbox into a
datagrid, But the problem is How can I obtain the name of the textbox and
send it to my jscript function???? The textbox is in a TemplateColumn
The Idea is sent to the funcion the name of the control and then pass it to
another window and then this child window must set the values of the
control. But for simplicity the problem get reduced to obtain the...
| |
by: RFS666 |
last post by:
Hello,
After I posted yesterday "using C# class in jscript", I have a new problem:
I have a C# class - DBResult - that contains (and other variables) a string
array (and other variables), that contains data from a database query which
is done in C# in codebehind. I create a jscript - script that is injected
into the aspx-page. I need this to fill an activeX-control with data.
I assign the string-array (and - for testing - a single...
|
by: Jer425 |
last post by:
Hello,
I'm coding in VB and trying to include a jscript file. This will not
work because you can only use one language in asp.net. Is there a way
that I can use the jscript without having to convert it to VB? I heard
something about using a component..is this true? Options?
Thanks all!
|
by: steve9013 |
last post by:
Hello. Hoping someone can help me out with this. Please forgive me as I'm very new to jscript.
I need to have the input box at the top of the page store the string to a variable. I then need that variable to be used in line 7. Since I'm not able to get the variable to work in line 7, i currently have 'testaccount' hard coded.
Hoping someone can help. Thanks in advance.
-Steve
<%@ language = JScript %>
<%
|
by: Arhaus |
last post by:
I was wondering if someone could help me out. I am new to jscript and I need to modify a calendar onclick event. We have a calendar which displays the dates either in green or red based upon data from a string variable:
Valiable example: var t = tDate;
tDate = "4/10/2009,4/24/2009,5/8/2009,5/22/2009"
The code is written to find a date in the tDate string, then the day number is Green or Red.
My question is that the jscript makes all...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |