Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 9th, 2006, 05:22 AM
Registered User
 
Join Date: Oct 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to daffodils
Default Problem with GetElementID


Hi, I'm programming in asp.net 2003. I designed a search utility using javascript in asp.net. But I'm stuck wen I'm trying to convert this utility to user control. There's a text box called txtSearch. This statement is not working here:-(I'm running it in IE 4 now)

var pre = document.getElementById ("txtSearch").value;

I tried to trap the value with this:

var sndr = window.event.srcElement;
var pre = sndr.text;

alert (pre);

the alert showed "undefined"....
can u tell me what r the other ways of getting the value?..pls



There's no defeat untill you stop trying....
 
Old November 9th, 2006, 07:12 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hiii daffodils!!

Plz check the user control id with text box called txtSearch.
basically when user control load on the page(in asp.net),it will generate the
id with(usercontrolname_textboxname).

plz check usercontrolid_txtSearch in ur getElementById.

also check the view source on the page,there you can exactly find the id of that txtSearch with like xxxx_txtSearch (where xxxx is usercontrolid)
hope this will help you

Cheers :)

vinod









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.