The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
Having installed an enhanced search facility to boost the search capabilities originally provided by search.asp. Is it possible to focus the cursor into the Keywords field on the form opening.
We have the following code for the Keywords field:
Response.Write "<input type=""text"" name=""Search"" size=""25"" value=""" & Trim(chkString(Request.QueryString("Search"),"search")) & """><br />" & vbCrLf
kind regards Andy<
We have the following code for the Keywords field:
Response.Write "<input type=""text"" name=""Search"" size=""25"" value=""" & Trim(chkString(Request.QueryString("Search"),"search")) & """><br />" & vbCrLf
kind regards Andy<
Postet den
Add an id attribute to your input tag and then add the following line to your javascript's onload function:<
Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Code:
document.getElementById("yourid").focus()
Search is your friend
“I was having a mildly paranoid day, mostly due to thefact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Postet den
Shaggy
Thank you for this but where is the javascript onload function? and where would I have to add an id attribute..
I have seen this bit of code in post.asp
Response.Write " <script language=""JavaScript"" type=""text/javascript"">document.PostTopic.Message.focus();</script>" & vbNewLine
Any additional help, as always is greatly appreciated.. steep learning curve here! andy<
Thank you for this but where is the javascript onload function? and where would I have to add an id attribute..
I have seen this bit of code in post.asp
Response.Write " <script language=""JavaScript"" type=""text/javascript"">document.PostTopic.Message.focus();</script>" & vbNewLine
Any additional help, as always is greatly appreciated.. steep learning curve here! andy<
Sist redigert av
Postet den
You'll need to add an onload function to inc_header.asp (the javascript begins on line 234) as follows:Where yourid is the value of the id attribute which, as stated, you need to add to your input tag.
<
Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Code:
function loader(){
document.getElementById("yourid").focus()
}
window.onload=loader<
Search is your friend
“I was having a mildly paranoid day, mostly due to thefact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Postet den
Hey Shaggy, since that JS will be added to the routines after 234,
should they be in Response.Write format? And if so, the ID tag will need double "" enclosures.
<
should they be in Response.Write format? And if so, the ID tag will need double "" enclosures.
Code:
"function loader(){" & vbNewLine & _
" document.getElementById(""yourid"").focus()" & vbNewLine & _
"}" & vbNewLine & _
"window.onload=loader" & vbNewLine & _
Sist redigert av
Postet den
I'm trying to add this to my search page. I added the onload function in inc_header.asp buy am not sure what to add in search.asp.
Here is what is currently there (the part in green is what I was trying to do - searchfocus is my id):
Response.Write "<input type=""text"" onload=""searchfocus"" name=""Search"" size=""25"" value=""" & Trim(chkString(Request.QueryString("Search"),"search")) & """><br />" & vbCrLf<
Here is what is currently there (the part in green is what I was trying to do - searchfocus is my id):
Response.Write "<input type=""text"" onload=""searchfocus"" name=""Search"" size=""25"" value=""" & Trim(chkString(Request.QueryString("Search"),"search")) & """><br />" & vbCrLf<
Postet den
Leatherlips, I have not got round to installing the code yet, correct me if I am wrong others, but the onload=""searchfocus"" could be id=""searchfocus""
I think that is what I understand from Shaggy's notion of input tag<
Postet den
Neither onload=""searchfocus nor id=""searchfocus"" works.<
Sist redigert av
Postet den
Shaggy
With "Where yourid is the value of the id attribute which, as stated, you need to add to your input tag" in mind, could you expand and help..<
With "Where yourid is the value of the id attribute which, as stated, you need to add to your input tag" in mind, could you expand and help..<
Postet den
You need to search for "input" (the line that actually requests data) in the forms of your post.asp and/or search_mod.asp/search.asp, wherever you want the focus. Add the id=""whatever"" tag to each.<
Postet den
Tried all the above and errors occur..
Looking at post.asp which focuses.. This is the message area code:
" <td bgColor=""" & strPopUpTableColor & """><textarea id=""ta1"" class=""textarea"" cols=""" & intCols & """ name=""Message"" rows=""" & intRows & """ wrap=""VIRTUAL"" onselect=""storeCaret(this);"" onclick=""storeCaret(this);"" onkeyup=""storeCaret(this);"" onchange=""storeCaret(this);"">" & Trim(CleanCode(TxtMsg)) & "</textarea><br /></td>" & vbNewLine & _
" </tr>" & vbNewLine
end if
select case strRqMethod
case "Reply", "ReplyQuote", "TopicQuote"
Response.Write " <script language=""JavaScript"" type=""text/javascript"">document.PostTopic.Message.focus();</script>" & vbNewLine
end select
is there away to almalgamate the focus script above into the search_mod script here:
Response.Write "<input type=""text"" name=""Search"" size=""25"" value=""" & Trim(chkString(Request.QueryString("Search"),"search")) & """><br />" & vbCrLf
What settings are required for: document.PostTopic.Message.focus<
Looking at post.asp which focuses.. This is the message area code:
" <td bgColor=""" & strPopUpTableColor & """><textarea id=""ta1"" class=""textarea"" cols=""" & intCols & """ name=""Message"" rows=""" & intRows & """ wrap=""VIRTUAL"" onselect=""storeCaret(this);"" onclick=""storeCaret(this);"" onkeyup=""storeCaret(this);"" onchange=""storeCaret(this);"">" & Trim(CleanCode(TxtMsg)) & "</textarea><br /></td>" & vbNewLine & _
" </tr>" & vbNewLine
end if
select case strRqMethod
case "Reply", "ReplyQuote", "TopicQuote"
Response.Write " <script language=""JavaScript"" type=""text/javascript"">document.PostTopic.Message.focus();</script>" & vbNewLine
end select
is there away to almalgamate the focus script above into the search_mod script here:
Response.Write "<input type=""text"" name=""Search"" size=""25"" value=""" & Trim(chkString(Request.QueryString("Search"),"search")) & """><br />" & vbCrLf
What settings are required for: document.PostTopic.Message.focus<
Sist redigert av
Email Member
Message Member
Post Moderation
Filopplasting
If you're having problems uploading, try choosing a smaller image.
Forhåndsvis post
Send Topic
Loading...