Click to See Complete Forum and Search --> : Replace '______' with a text box???


shanuragu
12-19-2003, 07:55 AM
Note : I had posted this under css section , later I was advised by one of the expert to post it under this section.

Hi

I am designing a quiz module, where in questions like fill in the blanks will be in the following pattern ..

I am a TeaPot __________ & ________.

This pattern is stored in the data base & displyed on the screen from the db (using while loop --using VB script).
My problem Is it possible to replace dash (ie, ______) with a text box so that the user can enter the answer in that?? .
How can recognize '-' using CSS??

My thinking using CSS is recoganize the '________' & replace it with a text box (innerHTML). Is it possible?? if so How can I implement it???

Also if I get '___' by InStr function of VB srting .. How can I replace it with a text box???

Please help its very urgent.

russell_g_1
12-27-2003, 11:40 AM
you'd have to do this server-side really, using asp. If you used the replace function to change the '_______'s one at a time you could name them as you like, and then get the answers back with another page (assuming you want to store them somwhere?)

PeOfEo
12-27-2003, 02:30 PM
replace(the string, "this", "with this")
so in your case
replace(string, "_____", textbox.text)

zachzach
12-27-2003, 02:36 PM
uh....this is sad......
use javascript
make divs around the text and then do index of, then cut both sides, replace the middle with a textbox...
CSS?innerHTML?Thats using javascript.And you dont need 2 do it serverside

zachzach
12-27-2003, 02:46 PM
to write them out, do that then send them in a querystring to another page

<script type="text/javascript">
^^^an array named array1 of the "the teapots name was_____" stuff things..just call them from querystrings^^^
Array2=new Array()
for(i=0;i<Array1.length;i++)
{
Array2(i)=Replace(Array1(i),"_____","<input type='text' id='Textbox" + i + "'>")
}
</script>

you'll have to improvise cuz that'll only work if theres only one "_____" in each string
call each textbox throught a for thats similar to that one...
to have a variable in a name of another varianble, do this:
("variable2" + variable1) = "variable2value"
if variable1="mmmmgrrr"
then...
variable2mmmmgrrr = "variable2value"
then just call each of the textboxes names(textbox1,textbox2...ect), and use document.write() to write them on the page

simple enough
lol

PeOfEo
12-27-2003, 11:45 PM
i think just running a few replace statements on one page, no redirects is easy enough then swapping out some elements. The whole point of doing it server side is because 13% of the internet will not support java script and that makes it not very functional.

zachzach
12-28-2003, 10:05 AM
just saying you dont need 2.....ye asp would do it better....and i guess php could do it 2