Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-13-2004, 06:42 AM   PM User | #1
rajeshsivapalan
New to the CF scene

 
Join Date: Dec 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
rajeshsivapalan is an unknown quantity at this point
Question Need Help..urgent.

Hi All,
Seasons best greetings!
I am new user in this forum...

I have problem ...

First have a look at the html and javascript code

//----------------Put the following in a notepad and save as file.htm and view result.

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body>
<form name="form1" method="post" action="">
<input
onblur="if (this.value == '') {this.value='Keyword';}"
onfocus="if (this.value == 'Keyword') {this.value='';}" maxLength=40 size=10
value=Keyword name=srchreq default="Keyword" col=""

onclick= "getElementById('__deepak').innerHTML = '<input name=Submit type=submit value=Go!>' ">

<div id = "__deepak"></div>

</form>
</body>
</html>

//---------------------------------

Issues faced are....

Issues

1) Internet Explorer
It is working fine except on click document event it is not disabling Go button.

2) Mozilla
It needs double click on text box to display Go button.

Thanks and regards
Rajesh
rajeshsivapalan is offline   Reply With Quote
Old 12-13-2004, 06:58 AM   PM User | #2
Brandoe85
teh Moderatorinator


 
Join Date: Sep 2004
Location: USA
Posts: 2,472
Thanks: 4
Thanked 40 Times in 40 Posts
Brandoe85 will become famous soon enough
Try this:
Code:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body>
<form name="form1" method="post" action="">
<input
onblur="if (this.value == '') {this.value='Keyword'; document.form1.Submit.disabled=true;}" maxLength=40 size=10
value=Keyword name=srchreq default="Keyword" col=""

onclick= "getElementById('__deepak').innerHTML = '<input name=Submit type=submit value=Go!>'; if (this.value == 'Keyword') {this.value='';}">

<div id = "__deepak"></div>

</form>
</body>
</html>
__________________
-Brando
Why using tables for eating is stupid!

Last edited by Brandoe85; 12-13-2004 at 07:07 AM.. Reason: had to change something...
Brandoe85 is offline   Reply With Quote
Old 12-13-2004, 07:15 AM   PM User | #3
rajeshsivapalan
New to the CF scene

 
Join Date: Dec 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
rajeshsivapalan is an unknown quantity at this point
Remove the button from the document instead of disabling it

hi
thanks for the reply, but i need to Remove the button from the document instead of disabling it onclick of the document also the keyword 'text' should appear in the input box.
thanks Rajesh.
rajeshsivapalan is offline   Reply With Quote
Old 12-13-2004, 07:19 AM   PM User | #4
Brandoe85
teh Moderatorinator


 
Join Date: Sep 2004
Location: USA
Posts: 2,472
Thanks: 4
Thanked 40 Times in 40 Posts
Brandoe85 will become famous soon enough
Change this line:
Code:
onblur="if (this.value == '') {this.value='Keyword'; document.form1.Submit.disabled=true;}" maxLength=40 size=10
to this:
Code:
onblur="if (this.value == '') {this.value='Keyword'; document.form1.Submit.style.display='none';}" maxLength=40 size=10
__________________
-Brando
Why using tables for eating is stupid!

Last edited by Brandoe85; 12-13-2004 at 07:24 AM..
Brandoe85 is offline   Reply With Quote
Old 12-13-2004, 07:49 AM   PM User | #5
rajeshsivapalan
New to the CF scene

 
Join Date: Dec 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
rajeshsivapalan is an unknown quantity at this point
Thanks a lot...

Quote:
Originally Posted by Brandoe85
Change this line:
Code:
onblur="if (this.value == '') {this.value='Keyword'; document.form1.Submit.disabled=true;}" maxLength=40 size=10
to this:
Code:
onblur="if (this.value == '') {this.value='Keyword'; document.form1.Submit.style.display='none';}" maxLength=40 size=10
Hi friend...

With your reference ...

I took help from my friend and solved problem like this..

\\-----------------

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body>
<form name="form1" method="post" action="">
<input
onblur="if (this.value == '') {this.value='Keyword'; getElementById('__deepak').innerHTML =' ';}" maxLength=40 size=10
value=Keyword name=srchreq default="Keyword" col=""

onclick= "getElementById('__deepak').innerHTML = '<input name=Submit type=submit value=Go!>'; if (this.value == 'Keyword') {this.value='';}">

<div id = "__deepak"></div>

</form>
</body>
</html>
\\---------------------------------

THanks once again..

Urs pal
Rajesh

NOte : by the way whats ur good name
rajeshsivapalan is offline   Reply With Quote
Old 12-13-2004, 08:04 AM   PM User | #6
Brandoe85
teh Moderatorinator


 
Join Date: Sep 2004
Location: USA
Posts: 2,472
Thanks: 4
Thanked 40 Times in 40 Posts
Brandoe85 will become famous soon enough
You're welcome, though I would use the style attribute rather then setting it to an empty string.
__________________
-Brando
Why using tables for eating is stupid!
Brandoe85 is offline   Reply With Quote
Old 12-13-2004, 08:15 AM   PM User | #7
rajeshsivapalan
New to the CF scene

 
Join Date: Dec 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
rajeshsivapalan is an unknown quantity at this point
Thumbs up YEah I used style as per ur suggestion.

Quote:
Originally Posted by Brandoe85
You're welcome, though I would use the style attribute rather then setting it to an empty string.
Hi,

I have used style as per ur suggestion. I would like to know if it helps in performance or how it is better than mine option as i could see both works fine.

regards
Rajesh
rajeshsivapalan is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:00 AM.


Advertisement
Log in to turn off these ads.