473,385 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

converting a variable within a append document.forms string

I have the following:
function(NAMED)
{
sString.Append("document.forms[0].NAMED.style.visibility = 'hidden'")
}

and would like to convert the NAMED into the object it represents - for
example in this case it represents the name of an image called card17

thanks
Dec 22 '05 #1
3 1300
Hi Barry,

Where are you getting the Append() method from? Is this server or client
side code? Neither the .Net String class (v1.1) or the JavaScript string
class (v2.0) have an append method as far as I can tell.

If this is client-side javascript as I suspect, I would suggest the
following. The replace() method uses regular expressions (yuck!):

function namedSubstitude( ElementName )
{
// assumes sString is in scope for somewhere...
sString.replace(/NAMED/i, ElementName) ;
}

Hope this helps,
Mark

barry wrote:
I have the following:
function(NAMED)
{
sString.Append("document.forms[0].NAMED.style.visibility = 'hidden'")
}

and would like to convert the NAMED into the object it represents - for
example in this case it represents the name of an image called card17

thanks

Dec 23 '05 #2
Sorry, should have been more explicit
This is in a codebehind file and is using IsStartupScriptRegistered to run
the javascript
all of what follows is in the script code

I am passing to a function a name attribute from an img tag. I have checked
the name attribute and it is what I want but
when I try to use it in the following script code I can not get the passed
attribute to convert to its actual value.
I have tried using

The attribute passed is called card

sString.Append("document.forms[0]." + card + ".style.visibility =
'hidden'")

You would think the above would work but the attribute card needs to be put
in "card" for the syntax to work and of course this does not convert
properly

Any help is appreciated.

"Mark Micallef" <ma***********@unspell.you.see.a.mess.net> wrote in message
news:ub**************@TK2MSFTNGP10.phx.gbl...
Hi Barry,

Where are you getting the Append() method from? Is this server or client
side code? Neither the .Net String class (v1.1) or the JavaScript string
class (v2.0) have an append method as far as I can tell.

If this is client-side javascript as I suspect, I would suggest the
following. The replace() method uses regular expressions (yuck!):

function namedSubstitude( ElementName )
{
// assumes sString is in scope for somewhere...
sString.replace(/NAMED/i, ElementName) ;
}

Hope this helps,
Mark

barry wrote:
I have the following:
function(NAMED)
{
sString.Append("document.forms[0].NAMED.style.visibility = 'hidden'")
}

and would like to convert the NAMED into the object it represents - for
example in this case it represents the name of an image called card17

thanks

Dec 23 '05 #3
Sorry, I was not more explicit
This is client side javascript in a codebehind
All of what I am about to say is in the javascript code
I have a img tag with a name attribute that I am passing to a function
The attribute when I run my browser over it shows up as the correct value
but will not convert in the code below

sString.Append("document.forms[0]." + card + ".style.visibility = 'hidden'")

First this gets a syntax error and I have to but the card(attribute passed)
in double quotes which will of course then not convert properly.

Any help would be appreciated.
"Mark Micallef" <ma***********@unspell.you.see.a.mess.net> wrote in message
news:ub**************@TK2MSFTNGP10.phx.gbl...
Hi Barry,

Where are you getting the Append() method from? Is this server or client
side code? Neither the .Net String class (v1.1) or the JavaScript string
class (v2.0) have an append method as far as I can tell.

If this is client-side javascript as I suspect, I would suggest the
following. The replace() method uses regular expressions (yuck!):

function namedSubstitude( ElementName )
{
// assumes sString is in scope for somewhere...
sString.replace(/NAMED/i, ElementName) ;
}

Hope this helps,
Mark

barry wrote:
I have the following:
function(NAMED)
{
sString.Append("document.forms[0].NAMED.style.visibility = 'hidden'")
}

and would like to convert the NAMED into the object it represents - for
example in this case it represents the name of an image called card17

thanks

Dec 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: BigDadyWeaver | last post by:
I am using the following code in asp to define a unique and unpredictable record ID in Access. <% 'GENERATE UNIQUE ID Function genguid() Dim Guid guid =...
3
by: rgarf | last post by:
I am converting a C++ application to C#, What in C# replaces the following C++ functions: overloaded opertaor= _ecvt(Math.Abs(val),14,&dec,&sign) ; //this function converts a double to a string...
0
by: Mark Allen | last post by:
Hello, I am creating an RTF document server side for a report. However I am having problems converting images into the required RTF format. I am converting the image into a string (binary)...
3
by: Mae | last post by:
Dear All, I have a problem here, I'm using C# Webform calling a webservices. The webservices return me a XMLnode, using this XMLnode I want to convert it to dataset so I can bind to the...
5
by: David | last post by:
I note that you can null teminate a string by adding controlchar.null. Is there a way of adding a null to a Buffer of Bytes and converting it to a string. I have packets coming in from a...
6
by: Jody Gelowitz | last post by:
I have run into an issue with variable scope within an XSLT document that is translated in VS.NET 2.0. Under VS.NET 1.1 (XslTransform), this code works fine. However, when using VS.NET 2.0...
11
by: Jean-François Michaud | last post by:
Hello all, I'm having a little problem, The UTF-8 parser we are using converts the newline entity ( ) within an attribute that we are using to paliate CSS limitations. After the parser has...
1
by: Kevin S Gallagher | last post by:
I found this code (pretty sure it was from a MVP) for converting a string variable to a form object which works fine within a form. Take the code and place it into a code module and it fails on the...
1
by: faultykid | last post by:
I would like to store a variable then call it back later. I have a variable on line 198 www = ''+this._ad.clickUrl+''; and on line 321 i try document.write(www);
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.